mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Issue #6.
This commit is contained in:
@@ -297,7 +297,8 @@ func (c *Compiler) parseInlineCode() string {
|
||||
output := "{}"
|
||||
|
||||
if len(code) > 2 {
|
||||
//output = "{"+Parse(Tokenize([]byte(code[1:len(code)-1])), pretty)+"}"
|
||||
compiler := Compiler{}
|
||||
output = "{"+compiler.Parse(Tokenize([]byte(code[1:len(code)-1])), false)+"}"
|
||||
}
|
||||
|
||||
c.expect(")")
|
||||
|
||||
@@ -146,6 +146,13 @@ func TestParserFunctionParams(t *testing.T) {
|
||||
equal(t, got, want)
|
||||
}
|
||||
|
||||
func TestParserInlineCode(t *testing.T) {
|
||||
got := getCompiled(t, "test/parser_code.asl")
|
||||
want := "inline_code = {a = 1;b = 2;if (a<b) then {[] call foo;};};\r\n"
|
||||
|
||||
equal(t, got, want)
|
||||
}
|
||||
|
||||
func getCompiled(t *testing.T, file string) string {
|
||||
code, err := ioutil.ReadFile(file)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user