main: move target specification into a separate package

This commit is contained in:
Ayke van Laethem
2019-10-31 15:39:01 +01:00
committed by Ron Evans
parent dff6e6566d
commit e7cf75030c
7 changed files with 129 additions and 114 deletions
+19
View File
@@ -0,0 +1,19 @@
package compileopts
import "testing"
func TestLoadTarget(t *testing.T) {
_, err := LoadTarget("arduino")
if err != nil {
t.Error("LoadTarget test failed:", err)
}
_, err = LoadTarget("notexist")
if err == nil {
t.Error("LoadTarget should have failed with non existing target")
}
if err.Error() != "expected a full LLVM target or a custom target in -target flag" {
t.Error("LoadTarget failed for wrong reason:", err)
}
}