Skip to content

Commit 34edd90

Browse files
committed
Some more tests.
1 parent 99c9e94 commit 34edd90

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

tests/entry_test.go

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,43 @@ func Test_more_functionality(t *testing.T) {
5656
}
5757

5858
func Test_obscure_functionality(t *testing.T) {
59+
sourceFile := "../data/helloworld.c"
5960
objectFile := "../data/bhello.notanextensionthatwerecognize"
60-
args := []string{"../data/helloworld.c", "-c", "-o", objectFile}
61+
exeFile := "../data/bhello"
62+
opSys := runtime.GOOS
63+
args := []string{sourceFile, "-c", "-o", objectFile}
6164
exitCode := shared.Compile(args, "clang")
6265
if exitCode != 0 {
6366
t.Errorf("Compile of %v returned %v\n", args, exitCode)
6467
} else {
6568
fmt.Println("Compiled OK")
6669
}
67-
ok, err := shared.IsObjectFileForOS(objectFile, runtime.GOOS)
70+
ok, err := shared.IsObjectFileForOS(sourceFile, opSys)
71+
if ok {
72+
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", sourceFile, opSys, ok)
73+
} else {
74+
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", sourceFile, opSys, ok, err)
75+
}
76+
ok, err = shared.IsObjectFileForOS(objectFile, opSys)
6877
if !ok {
69-
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, runtime.GOOS, ok, err)
78+
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, opSys, ok, err)
7079
} else {
71-
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, runtime.GOOS, ok)
80+
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, opSys, ok)
7281
}
73-
args = []string{objectFile, "-o", "../data/bhello"}
82+
args = []string{objectFile, "-o", exeFile}
7483
exitCode = shared.Compile(args, "clang")
7584
if exitCode != 0 {
7685
t.Errorf("Compile of %v returned %v\n", args, exitCode)
7786
} else {
7887
fmt.Println("Compiled OK")
7988
}
80-
args = []string{"get-bc", "-v", "../data/bhello"}
89+
ok, err = shared.IsObjectFileForOS(exeFile, opSys)
90+
if ok {
91+
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", exeFile, opSys, ok)
92+
} else {
93+
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", exeFile, opSys, ok, err)
94+
}
95+
args = []string{"get-bc", "-v", exeFile}
8196
exitCode = shared.Extract(args)
8297
if exitCode != 0 {
8398
t.Errorf("Extraction of %v returned %v\n", args, exitCode)

0 commit comments

Comments
 (0)