mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 16:20:17 +02:00
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.
This commit is contained in:
parent
3092a14d67
commit
7ab42fa20c
2 changed files with 49 additions and 11 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue