示例#1
0
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)
}
示例#2
0
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)
}
示例#3
0
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)
}
示例#4
0
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)
}
示例#5
0
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")
	}
}
示例#6
0
// 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
	}
}