diff options
author | Andy Wingo <wingo@pobox.com> | 2009-10-23 15:47:08 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-10-23 16:02:51 +0200 |
commit | 7ab42fa20cd997ce6ccb4f3f59bb400e04d2d666 (patch) | |
tree | 56c18c3b5825a35b13e2d3e367b0d6f6758fa3b9 /libguile/modules.c | |
parent | 3092a14d6758bd002113ffe4bc51e4c6930c4ce5 (diff) | |
download | guile-7ab42fa20cd997ce6ccb4f3f59bb400e04d2d666.tar.gz |
add some optargs tests
* libguile/modules.c (scm_module_lookup, scm_lookup): Throw to
'unbound-variable, like eval.i.c does.
* test-suite/tests/optargs.test: Add an optargs test. Run optargs tests
under both the VM and the interpreter.
Diffstat (limited to 'libguile/modules.c')
-rw-r--r-- | libguile/modules.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libguile/modules.c b/libguile/modules.c index deae23a59..c7f0a46b0 100644 --- a/libguile/modules.c +++ b/libguile/modules.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008 Free Software Foundation, Inc. +/* Copyright (C) 1998,2000,2001,2002,2003,2004,2006,2007,2008,2009 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -46,6 +46,12 @@ static SCM the_module; static SCM the_root_module_var; +static SCM unbound_variable (const char *func, SCM sym) +{ + scm_error (scm_from_locale_symbol ("unbound-variable"), func, + "Unbound variable: ~S", scm_list_1 (sym), SCM_BOOL_F); +} + static SCM the_root_module () { @@ -740,7 +746,7 @@ scm_module_lookup (SCM module, SCM sym) var = scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F); if (scm_is_false (var)) - SCM_MISC_ERROR ("unbound variable: ~S", scm_list_1 (sym)); + unbound_variable (FUNC_NAME, sym); return var; } #undef FUNC_NAME @@ -757,7 +763,7 @@ scm_lookup (SCM sym) SCM var = scm_sym2var (sym, scm_current_module_lookup_closure (), SCM_BOOL_F); if (scm_is_false (var)) - scm_misc_error ("scm_lookup", "unbound variable: ~S", scm_list_1 (sym)); + unbound_variable (NULL, sym); return var; } |