70 lines
1.7 KiB
Plaintext
70 lines
1.7 KiB
Plaintext
# @TEST-EXEC: hiltic -j true.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false1.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false2.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false3.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false4.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false5.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false6.hlt >>output 2>&1
|
|
# @TEST-EXEC-FAIL: hiltic -j false7.hlt >>output 2>&1
|
|
#
|
|
# Since the output might contain compiler diagnostics for generated code, strip
|
|
# out anything but the assertion messages under test.
|
|
# @TEST-EXEC: grep AssertionFailure: output > output2 && mv output2 output
|
|
#
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
@TEST-START-FILE true.hlt
|
|
module Foo {
|
|
|
|
assert True;
|
|
assert 4 == 4;
|
|
assert 4 == 4 : "This is a message";
|
|
assert 4 == 4 : error("This is a message");
|
|
|
|
global iterator<bytes> i;
|
|
assert-exception *i : "No exception!";
|
|
|
|
}
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false1.hlt
|
|
module Foo { assert False; }
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false2.hlt
|
|
module Foo { assert 5 == 6 : "Test message"; }
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false3.hlt
|
|
module Foo { assert-exception "all good": "Test message for missing exception"; }
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false4.hlt
|
|
module Foo { assert 5 == 6 : error("Test message"); }
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false5.hlt
|
|
module Foo {
|
|
global auto x = False : "original";
|
|
assert x;
|
|
}
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false6.hlt
|
|
module Foo {
|
|
global auto x = False : "original";
|
|
assert x: "overloaded";
|
|
}
|
|
@TEST-END-FILE
|
|
|
|
@TEST-START-FILE false7.hlt
|
|
module Foo {
|
|
function result<string> foo() {
|
|
return error("asdasd");
|
|
}
|
|
|
|
assert foo(); # produces error with above message.
|
|
}
|
|
|
|
@TEST-END-FILE
|