-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1666 from xushiwei/class
unit: subtest
- Loading branch information
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |