@@ -56,28 +56,43 @@ func Test_more_functionality(t *testing.T) {
56
56
}
57
57
58
58
func Test_obscure_functionality (t * testing.T ) {
59
+ sourceFile := "../data/helloworld.c"
59
60
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 }
61
64
exitCode := shared .Compile (args , "clang" )
62
65
if exitCode != 0 {
63
66
t .Errorf ("Compile of %v returned %v\n " , args , exitCode )
64
67
} else {
65
68
fmt .Println ("Compiled OK" )
66
69
}
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 )
68
77
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 )
70
79
} else {
71
- fmt .Printf ("isObjectFileForOS(%v, %v) = %v\n " , objectFile , runtime . GOOS , ok )
80
+ fmt .Printf ("isObjectFileForOS(%v, %v) = %v\n " , objectFile , opSys , ok )
72
81
}
73
- args = []string {objectFile , "-o" , "../data/bhello" }
82
+ args = []string {objectFile , "-o" , exeFile }
74
83
exitCode = shared .Compile (args , "clang" )
75
84
if exitCode != 0 {
76
85
t .Errorf ("Compile of %v returned %v\n " , args , exitCode )
77
86
} else {
78
87
fmt .Println ("Compiled OK" )
79
88
}
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 }
81
96
exitCode = shared .Extract (args )
82
97
if exitCode != 0 {
83
98
t .Errorf ("Extraction of %v returned %v\n " , args , exitCode )
0 commit comments