Skip to content

Commit

Permalink
完善 ci 测试
Browse files Browse the repository at this point in the history
  • Loading branch information
chai2010 committed May 27, 2023
1 parent 23cbd05 commit 147fb2c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ arduino-build:
ci-test-all:
go test ./...

@echo "== std test begin =="
go run main.go test fmt
@echo "== std ok =="

go run main.go hello.wa

make -C ./_examples ci-test-all
Expand Down
1 change: 1 addition & 0 deletions _examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ ci-test-all:
cd ./reftoptr && make

# snake
cd ./snake && make publish

go run ../main.go interface_named.wa
go run ../main.go struct.wa
Expand Down
4 changes: 2 additions & 2 deletions _examples/snake/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
build:
-@rm ./web/*.wasm
go run ../../main.go fmt ./src/main.wa
go run ../../main.go fmt ./src/canvas/canvas.wa
#go run ../../main.go fmt ./src/main.wa
#go run ../../main.go fmt ./src/canvas/canvas.wa

go run ../../main.go build -o ./web/snake.wasm .

Expand Down
6 changes: 3 additions & 3 deletions _examples/snake/src/main.wa
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ const BodyColor = 0xFF202020
const FoodColor = 0xFF00FF00

const (
GridNull i8 = iota
GridNull: i8 = iota
GridBody
GridFood
)

const (
DirNull i32 = iota
DirNull: i32 = iota
DirLeft
DirUp
DirRight
Expand Down Expand Up @@ -101,7 +101,7 @@ func GameState.SetGridType(p: Position, t: i8) {
}

#wa:import wa_js_env rand
func rand_JS(i32) => i32
func rand_JS(_: i32) => i32
func GameState.GenFood() => Position {
var p: Position
for {
Expand Down
2 changes: 1 addition & 1 deletion internal/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@ func (p *parser) parseValueSpec(doc *ast.CommentGroup, keyword token.Token, iota
colonPos = p.pos
p.next()
} else {
if p.tok != token.ASSIGN {
if p.tok != token.ASSIGN && p.tok != token.SEMICOLON {
p.expect(token.COLON)
}
}
Expand Down
9 changes: 4 additions & 5 deletions internal/waroot/_waroot/src/fmt/zz_test.wa
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
// 版权 @2023 凹语言 作者。保留所有权利。

func TestFailed_assert {
func TestOK_assert {
ok := true
assert(ok)

ok = false
assert(ok, "message")
assert(true, "message")
}

func TestFailed_output {
func TestOK_output {
println("abc 123")

// Output:
// abc 1232
// abc 123
}

0 comments on commit 147fb2c

Please sign in to comment.