aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-30 04:04:40 -0300
committerEuAndreh <eu@euandre.org>2025-01-30 04:04:40 -0300
commite2e124899ff21ae13c454c3b18472383285ffc5d (patch)
treefac7ebca84b09423f4c7f043161e6d5889067cb7 /tests
parenttests/dedo.go: Add tests for getopt() and runCommand() (diff)
downloaddedo-e2e124899ff21ae13c454c3b18472383285ffc5d.tar.gz
dedo-e2e124899ff21ae13c454c3b18472383285ffc5d.tar.xz
src/dedo.go: Parameterize the file "magic" byte markers
Diffstat (limited to 'tests')
-rw-r--r--tests/dedo.go21
1 files changed, 17 insertions, 4 deletions
diff --git a/tests/dedo.go b/tests/dedo.go
index 0c33a59..ba78b34 100644
--- a/tests/dedo.go
+++ b/tests/dedo.go
@@ -88,8 +88,8 @@ func test_newDB() {
g.TestStart("newDB()")
g.Testing("different path are given back", func() {
- db1 := newDB("path1", nil)
- db2 := newDB("path2", nil)
+ db1 := newDB("path1", nil, defaultOptions)
+ db2 := newDB("path2", nil, defaultOptions)
g.TAssertEqual(db1.path, "path1")
g.TAssertEqual(db2.path, "path2")
@@ -99,11 +99,24 @@ func test_newDB() {
f1 := new(os.File)
f2 := new(os.File)
- db1 := newDB("path", f1)
- db2 := newDB("path", f2)
+ db1 := newDB("", f1, defaultOptions)
+ db2 := newDB("", f2, defaultOptions)
g.TAssertEqual(db1 == db2, false)
})
+
+ g.Testing("different magic values", func() {
+ customOptions := OpenOptionsT{
+ Magic: 0xafacada1,
+ }
+
+ db1 := newDB("", nil, defaultOptions)
+ db2 := newDB("", nil, customOptions)
+
+ g.TAssertEqual(db1.magic, defaultMagic)
+ g.TAssertEqual(db2.magic, uint32(0xafacada1))
+ g.TAssertEqual(db1.magic == db2.magic, false)
+ })
}
func test_openFile() {