...
The following test case was saved as BOO-46-1.boo since it is related to the BOO-46 bug.
| Code Block |
|---|
import NUnit.Framework class Foo: _prefix as object def constructor(prefix): _prefix = prefix def call(c as ICallable): return c() def foo(): return "${_prefix} - foo" def run(): return call(foo) Assert.AreEqual("bar - foo", Foo("bar").run()) |
...
- writing a boo module with the code you want to make sure the parser is able to handle correctly
- adding the roundtrip form of this same code as the module's documentation string
- saving the module in the tests/testcases/parser/roundtrip directory
Example:
| Code Block |
|---|
"""
import Gtk from 'gtk-sharp'
import FooBar from 'foo-bar'
"""
import Gtk from "gtk-sharp"
import FooBar from 'foo-bar'
|
...
The test case must be saved in the tests/testcases/errors directory with a name in the form <error code>-<sequential number>.boo.
| Code Block |
|---|
"""
BCE0005-1.boo(9,11): BCE0005: Unknown identifier: local.
"""
def foo():
local = "foo"
bar()
def bar():
print(local)
|
...
Take for instance one of the integration test cases for the and operator:
| Code Block |
|---|
"""
True
True
3
evaluated
False
evaluated
evaluated
True
True
0
"""
def fun(value):
print('evaluated')
return value
a = null and true
print(a is null)
b = true and 3
print(b isa int)
print(b)
c = fun(false) and fun(true)
print(c)
d = fun(true) and fun(null)
print(d is null)
e = 0 and false
print(e isa int)
print(e)
|
...
