Added test for bugfix, cleaned up repo (issue #35 and #36).

This commit is contained in:
Marvin Blum
2016-02-08 15:09:48 +01:00
parent 28fbbd7e10
commit 944b91c16b
7 changed files with 29 additions and 41 deletions

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>asl</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.googlecode.goclipse.goBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.googlecode.goclipse.core.goNature</nature>
</natures>
</projectDescription>

23
ToDo.md
View File

@@ -1,23 +0,0 @@
# ToDo
* ~~assign to returned values~~
* ~~sqf: ... sqf whitespace~~
* ~~solution for build in commands which do not require left values~~
* ~~pretty/minified printing~~
* ~~usage~~
* ~~recursive compiling~~
* ~~concurrent compiling~~
* ~~inline buildin function call -> foo(a)(bar(x)(y));~~
* ~~negative values e.g. -1, operator !~~
* ~~tokenizer splits commands like "format" -> for, mat~~
* ~~try ... catch~~
* ~~better error reporting~~
- ~~recover panic~~
- ~~line, column~~
* type check for functions
## Special cases
* ~~exitWith...~~
* ~~waitUntil...~~
* ~~!buildInFunc()()...~~

6
build Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/home/marvin/Projekte/asl
go build -ldflags "-s -w" src/main/asl.go

6
run Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/home/marvin/Projekte/asl
go run src/main/asl.go $1 $2

6
run_tests Executable file
View File

@@ -0,0 +1,6 @@
#!/bin/bash
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export GOPATH=/home/marvin/Projekte/asl
go test parser tokenizer types

View File

@@ -35,7 +35,7 @@ func TestParserIf(t *testing.T) {
func TestParserWhile(t *testing.T) {
got := getCompiled(t, "../../test/tokenizer_while.asl")
want := "while {true} do {\r\n};"
want := "while {true} do {\r\n};\r\n"
equal(t, got, want)
}
@@ -195,6 +195,14 @@ func TestParserExpressionArray(t *testing.T) {
equal(t, got, want)
}
// bugfix: unary function parsing (e.g. "format")
func TestBugfixParserUnaryFunction(t *testing.T) {
got := getCompiled(t, "../../test/bugfix_unary_func_format.asl")
want := "format [\"%1 %2\", \"value1\", \"value2\"];\r\n[\"a\", \"b\", \"c\"] call someFunc;\r\n"
equal(t, got, want)
}
func getCompiled(t *testing.T, file string) string {
code, err := ioutil.ReadFile(file)

View File

@@ -0,0 +1,2 @@
format("%1 %2", "value1", "value2"); // must result in format [...];
someFunc("a", "b", "c"); // must result in ... call someFunc;