Skip to content

Commit

Permalink
Merge pull request #1666 from xushiwei/class
Browse files Browse the repository at this point in the history
unit: subtest
  • Loading branch information
xushiwei committed Jan 25, 2024
2 parents e46718b + 910185f commit 18856d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions testdata/unit-test/foo.gop
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
func foo() int {
return 100
func foo(v int) int {
return v * 2
}
16 changes: 14 additions & 2 deletions testdata/unit-test/foo_test.gox
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
if v := foo(); v == 100 {
t.log "test bar ok"
if v := foo(50); v == 100 {
t.log "test foo(50) ok"
} else {
t.error "foo() ret: ${v}"
}

t.run "foo -10", t => {
if foo(-10) != -20 {
t.fatal "foo(-10) != -20"
}
}

t.run "foo 0", t => {
if foo(0) != 0 {
t.fatal "foo(0) != 0"
}
}

0 comments on commit 18856d1

Please sign in to comment.