52 lines
1.0 KiB
Plaintext
52 lines
1.0 KiB
Plaintext
# @TEST-EXEC: ${HILTIC} -P "" -o Foo.h %INPUT
|
|
# @TEST-EXEC: ${HILTIC} -j -D compiler,jit %INPUT driver.cc >output
|
|
# @TEST-EXEC: btest-diff output
|
|
|
|
module Foo {
|
|
|
|
import hilti;
|
|
|
|
public type MyException = exception;
|
|
|
|
function extern void test() {
|
|
hilti::print("HILTI - Begin");
|
|
throw MyException("test exception");
|
|
hilti::print("HILTI - End - Not reached");
|
|
}
|
|
|
|
}
|
|
|
|
@TEST-START-FILE driver.cc
|
|
|
|
#include <hilti/rt/libhilti.h>
|
|
|
|
#include "Foo.h"
|
|
|
|
extern "C" int HILTI_EXPORT hilti_main() { // Point of entry for JIT
|
|
try {
|
|
auto r = hlt::Foo::test();
|
|
|
|
while ( ! r ) {
|
|
std::cout << "suspended, resuming" << std::endl;
|
|
r.resume();
|
|
}
|
|
|
|
std::cout << "Done, but shouldn't get here" << std::endl;
|
|
}
|
|
|
|
catch ( const hilti::rt::Exception& e ) {
|
|
std::cout << "Caught exception: " << e.what() << std::endl;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
hilti::rt::init();
|
|
hilti_main();
|
|
hilti::rt::done();
|
|
return 0;
|
|
}
|
|
|
|
@TEST-END-FILE
|