Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit 944b91c

Browse files
committed
Added test for bugfix, cleaned up repo (issue #35 and #36).
1 parent 28fbbd7 commit 944b91c

File tree

7 files changed

+29
-41
lines changed

7 files changed

+29
-41
lines changed

.project

-17
This file was deleted.

ToDo.md

-23
This file was deleted.

build

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export GOROOT=/usr/local/go
4+
export PATH=$PATH:$GOROOT/bin
5+
export GOPATH=/home/marvin/Projekte/asl
6+
go build -ldflags "-s -w" src/main/asl.go

run

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export GOROOT=/usr/local/go
4+
export PATH=$PATH:$GOROOT/bin
5+
export GOPATH=/home/marvin/Projekte/asl
6+
go run src/main/asl.go $1 $2

run_tests

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export GOROOT=/usr/local/go
4+
export PATH=$PATH:$GOROOT/bin
5+
export GOPATH=/home/marvin/Projekte/asl
6+
go test parser tokenizer types

src/parser/parser_test.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestParserIf(t *testing.T) {
3535

3636
func TestParserWhile(t *testing.T) {
3737
got := getCompiled(t, "../../test/tokenizer_while.asl")
38-
want := "while {true} do {\r\n};"
38+
want := "while {true} do {\r\n};\r\n"
3939

4040
equal(t, got, want)
4141
}
@@ -195,6 +195,14 @@ func TestParserExpressionArray(t *testing.T) {
195195
equal(t, got, want)
196196
}
197197

198+
// bugfix: unary function parsing (e.g. "format")
199+
func TestBugfixParserUnaryFunction(t *testing.T) {
200+
got := getCompiled(t, "../../test/bugfix_unary_func_format.asl")
201+
want := "format [\"%1 %2\", \"value1\", \"value2\"];\r\n[\"a\", \"b\", \"c\"] call someFunc;\r\n"
202+
203+
equal(t, got, want)
204+
}
205+
198206
func getCompiled(t *testing.T, file string) string {
199207
code, err := ioutil.ReadFile(file)
200208

test/bugfix_unary_func_format.asl

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

0 commit comments

Comments
 (0)