]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/tests/linkage-errors.factor
factor: arch -> arch-name. fix breakage caused by other patch.
[factor.git] / basis / compiler / tests / linkage-errors.factor
1 USING: tools.test namespaces assocs alien.syntax kernel
2 compiler.errors accessors alien alien.c-types alien.strings
3 debugger literals kernel.private alien.libraries ;
4 IN: compiler.tests.linkage-errors
5
6 ! Regression: calling an undefined function would raise a protection fault
7 FUNCTION: void this_does_not_exist ( )
8
9 [ this_does_not_exist ] try
10
11 [ this_does_not_exist ] [
12     ${ "kernel-error" ERROR-UNDEFINED-SYMBOL "this_does_not_exist" string>symbol f }
13     =
14 ] must-fail-with
15
16 [ T{ no-such-symbol { name "this_does_not_exist" } } ]
17 [
18     \ this_does_not_exist linkage-errors get at error>>
19     ! We don't care about the error message from dlerror, just
20     ! wipe it out
21     clone f >>message
22 ] unit-test
23
24 << "no_such_library" "no_such_library" cdecl add-library >>
25
26 LIBRARY: no_such_library
27
28 FUNCTION: void no_such_function ( )
29
30 [ no_such_function ] try
31
32 [ no_such_function ] [
33     ${
34         "kernel-error" ERROR-UNDEFINED-SYMBOL
35         "no_such_function" string>symbol
36         "no_such_library" load-library
37     }
38     =
39 ] must-fail-with
40
41 [ T{ no-such-library { name "no_such_library" } } ]
42 [
43     \ no_such_function linkage-errors get at error>>
44     ! We don't care about the error message from dlerror, just
45     ! wipe it out
46     clone f >>message
47 ] unit-test