Skip to content

Commit

Permalink
Some more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianamason committed Oct 30, 2020
1 parent 99c9e94 commit 34edd90
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions tests/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,28 +56,43 @@ func Test_more_functionality(t *testing.T) {
}

func Test_obscure_functionality(t *testing.T) {
sourceFile := "../data/helloworld.c"
objectFile := "../data/bhello.notanextensionthatwerecognize"
args := []string{"../data/helloworld.c", "-c", "-o", objectFile}
exeFile := "../data/bhello"
opSys := runtime.GOOS
args := []string{sourceFile, "-c", "-o", objectFile}
exitCode := shared.Compile(args, "clang")
if exitCode != 0 {
t.Errorf("Compile of %v returned %v\n", args, exitCode)
} else {
fmt.Println("Compiled OK")
}
ok, err := shared.IsObjectFileForOS(objectFile, runtime.GOOS)
ok, err := shared.IsObjectFileForOS(sourceFile, opSys)
if ok {
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", sourceFile, opSys, ok)
} else {
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", sourceFile, opSys, ok, err)
}
ok, err = shared.IsObjectFileForOS(objectFile, opSys)
if !ok {
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, runtime.GOOS, ok, err)
t.Errorf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", objectFile, opSys, ok, err)
} else {
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, runtime.GOOS, ok)
fmt.Printf("isObjectFileForOS(%v, %v) = %v\n", objectFile, opSys, ok)
}
args = []string{objectFile, "-o", "../data/bhello"}
args = []string{objectFile, "-o", exeFile}
exitCode = shared.Compile(args, "clang")
if exitCode != 0 {
t.Errorf("Compile of %v returned %v\n", args, exitCode)
} else {
fmt.Println("Compiled OK")
}
args = []string{"get-bc", "-v", "../data/bhello"}
ok, err = shared.IsObjectFileForOS(exeFile, opSys)
if ok {
t.Errorf("isObjectFileForOS(%v, %v) = %v\n", exeFile, opSys, ok)
} else {
fmt.Printf("isObjectFileForOS(%v, %v) = %v (err = %v)\n", exeFile, opSys, ok, err)
}
args = []string{"get-bc", "-v", exeFile}
exitCode = shared.Extract(args)
if exitCode != 0 {
t.Errorf("Extraction of %v returned %v\n", args, exitCode)
Expand Down

0 comments on commit 34edd90

Please sign in to comment.