func TestParserNullBuildinFunctionCall(t *testing.T) { types.LoadTypes(types_file) got := getCompiled(t, "../../test/parser_null_buildin_func.asl") want := "_volume = (radioVolume);\r\n" equal(t, got, want) }
func TestParserPreprocessor(t *testing.T) { types.LoadTypes(types_file) got := getCompiled(t, "../../test/tokenizer_preprocessor.asl") want := "\r\n#define HELLO_WORLD \"Hello World!\"\r\nhint HELLO_WORLD;\r\n" equal(t, got, want) }
func TestParserBinaryBuildinFunctionCall(t *testing.T) { types.LoadTypes(types_file) got := getCompiled(t, "../../test/parser_binary_buildin_func.asl") want := "someCar setHit [\"motor\", 1];\r\n" equal(t, got, want) }
func TestParserUnaryBuildinFunctionCall(t *testing.T) { types.LoadTypes(types_file) got := getCompiled(t, "../../test/parser_unary_buildin_func.asl") want := "_isReady = (unitReady soldier);\r\n" equal(t, got, want) }
func TestTypesGetFunction(t *testing.T) { if err := types.LoadTypes("../../test/types"); err != nil { t.Error(err) } function := types.GetFunction("hint") if function == nil { t.Error("Function 'hint' not found in type list") } }
// Loads types from types file. // If none is provided, an error will be printed. func loadTypes() { if err := types.LoadTypes(typeinfo); err != nil { fmt.Println("No 'types' file provided. Please add type information to this file from 'supportInfo' script command output.") exit = true } }