Adding in some lexer testing.
This commit is contained in:
parent
68cf93e6d0
commit
d9b6fe7d79
10
test.py
10
test.py
@ -1,10 +0,0 @@
|
||||
|
||||
from hy.lex.tokenize import tokenize
|
||||
|
||||
print tokenize("""
|
||||
(+ 2 (+ 1 1) (- 1 1))
|
||||
""")
|
||||
|
||||
print tokenize("""
|
||||
(print "Hello, \\n World")
|
||||
""")
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/lexer/__init__.py
Normal file
0
tests/lexer/__init__.py
Normal file
20
tests/lexer/test_basic_lexing.py
Normal file
20
tests/lexer/test_basic_lexing.py
Normal file
@ -0,0 +1,20 @@
|
||||
from hy.lex.tokenize import tokenize
|
||||
|
||||
|
||||
def test_simple_tokenize():
|
||||
assert [["+", "1", "1"]] == tokenize("(+ 1 1)")
|
||||
|
||||
|
||||
def test_double_tokenize():
|
||||
assert [
|
||||
["+", "1", "2"],
|
||||
["-", "1", "1"]
|
||||
] == tokenize("(+ 1 2) (- 1 1)")
|
||||
|
||||
|
||||
def test_simple_recurse():
|
||||
assert [
|
||||
'+', '1', [
|
||||
'+', '1', '1'
|
||||
]
|
||||
] == tokenize("(+ 1 (+ 1 1))")
|
Loading…
Reference in New Issue
Block a user