2017-04-27 23:16:57 +02:00
|
|
|
# Copyright 2017 the authors.
|
|
|
|
# This file is part of Hy, which is free software licensed under the Expat
|
|
|
|
# license. See the LICENSE.
|
|
|
|
|
2013-12-15 17:47:24 +01:00
|
|
|
from hy.macros import macroexpand
|
2015-12-23 21:13:18 +01:00
|
|
|
from hy.compiler import HyTypeError, HyASTCompiler
|
2013-12-15 17:47:24 +01:00
|
|
|
from hy.lex import tokenize
|
|
|
|
|
|
|
|
|
2017-04-21 17:07:48 +02:00
|
|
|
def test_sharp_macro_error():
|
2015-12-08 14:43:47 +01:00
|
|
|
"""Check if we get correct error with wrong dispatch character"""
|
2013-12-15 17:47:24 +01:00
|
|
|
try:
|
2017-04-21 17:07:48 +02:00
|
|
|
macroexpand(tokenize("(dispatch_sharp_macro '- '())")[0],
|
2015-12-23 21:13:18 +01:00
|
|
|
HyASTCompiler(__name__))
|
2013-12-15 17:47:24 +01:00
|
|
|
except HyTypeError as e:
|
|
|
|
assert "with the character `-`" in str(e)
|