Merge branch 'h/kwargs-need-value-fix'
Closes #815, #821, #822. Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
This commit is contained in:
commit
4834b59cba
@ -459,8 +459,9 @@ class HyASTCompiler(object):
|
|||||||
try:
|
try:
|
||||||
value = next(exprs_iter)
|
value = next(exprs_iter)
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
msg = "Keyword argument {kw} needs a value"
|
raise HyTypeError(expr,
|
||||||
raise HyCompileError(msg.format(kw=str(expr)))
|
"Keyword argument {kw} needs "
|
||||||
|
"a value.".format(kw=str(expr[1:])))
|
||||||
|
|
||||||
compiled_value = self.compile(value)
|
compiled_value = self.compile(value)
|
||||||
ret += compiled_value
|
ret += compiled_value
|
||||||
|
@ -439,6 +439,16 @@ def test_lambda_list_keywords_mixed():
|
|||||||
" (list x xs kwxs kwoxs))")
|
" (list x xs kwxs kwoxs))")
|
||||||
|
|
||||||
|
|
||||||
|
def test_missing_keyword_argument_value():
|
||||||
|
"""Ensure the compiler chokes on missing keyword argument values."""
|
||||||
|
try:
|
||||||
|
can_compile("((fn [x] x) :x)")
|
||||||
|
except HyTypeError as e:
|
||||||
|
assert(e.message == "Keyword argument :x needs a value.")
|
||||||
|
else:
|
||||||
|
assert(False)
|
||||||
|
|
||||||
|
|
||||||
def test_ast_unicode_strings():
|
def test_ast_unicode_strings():
|
||||||
"""Ensure we handle unicode strings correctly"""
|
"""Ensure we handle unicode strings correctly"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user