| 
									
										
										
										
											2010-05-09 21:36:52 -04:00
										 |  |  | USING: tools.test namespaces assocs alien.syntax kernel | 
					
						
							| 
									
										
										
										
											2011-09-12 03:56:24 -04:00
										 |  |  | compiler.errors accessors alien alien.c-types alien.strings | 
					
						
							|  |  |  | debugger literals ;
 | 
					
						
							|  |  |  | FROM: alien.libraries => add-library load-library ;
 | 
					
						
							| 
									
										
										
										
											2010-05-09 21:36:52 -04:00
										 |  |  | IN: compiler.tests.linkage-errors | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Regression: calling an undefined function would raise a protection fault | 
					
						
							|  |  |  | FUNCTION: void this_does_not_exist ( ) ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-12 03:56:24 -04:00
										 |  |  | [ this_does_not_exist ] try | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ this_does_not_exist ] [ | 
					
						
							|  |  |  |     { "kernel-error" 9 $[ "this_does_not_exist" string>symbol ] f } | 
					
						
							|  |  |  |     =
 | 
					
						
							|  |  |  | ] must-fail-with | 
					
						
							| 
									
										
										
										
											2010-05-09 21:36:52 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ T{ no-such-symbol { name "this_does_not_exist" } } ] | 
					
						
							| 
									
										
										
										
											2011-09-13 23:42:36 -04:00
										 |  |  | [ | 
					
						
							|  |  |  |     \ this_does_not_exist linkage-errors get at error>> | 
					
						
							|  |  |  |     ! We don't care about the error message from dlerror, just | 
					
						
							|  |  |  |     ! wipe it out | 
					
						
							| 
									
										
										
										
											2011-09-14 04:07:45 -04:00
										 |  |  |     clone f >>message | 
					
						
							| 
									
										
										
										
											2011-09-13 23:42:36 -04:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2010-05-09 21:36:52 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | << "no_such_library" "no_such_library" cdecl add-library >> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | LIBRARY: no_such_library | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | FUNCTION: void no_such_function ( ) ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-12 03:56:24 -04:00
										 |  |  | [ no_such_function ] try | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ no_such_function ] [ | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         "kernel-error" 9
 | 
					
						
							|  |  |  |         $[ "no_such_function" string>symbol ] | 
					
						
							|  |  |  |         $[ "no_such_library" load-library ] | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     =
 | 
					
						
							|  |  |  | ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-05-09 21:36:52 -04:00
										 |  |  | [ T{ no-such-library { name "no_such_library" } } ] | 
					
						
							| 
									
										
										
										
											2011-09-13 23:42:36 -04:00
										 |  |  | [ | 
					
						
							|  |  |  |     \ no_such_function linkage-errors get at error>> | 
					
						
							|  |  |  |     ! We don't care about the error message from dlerror, just | 
					
						
							|  |  |  |     ! wipe it out | 
					
						
							|  |  |  |     clone f >>message | 
					
						
							|  |  |  | ] unit-test |