Adding more testing.
This commit is contained in:
parent
efdccb75bb
commit
b42fdc0bb7
@ -18,7 +18,15 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
# DEALINGS IN THE SOFTWARE.
|
# DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
from abc import ABCMeta, abstractmethod
|
||||||
|
|
||||||
|
|
||||||
class HyCompiler(object):
|
class HyCompiler(object):
|
||||||
|
__metaclass__ = ABCMeta
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def compile(self, tree):
|
||||||
|
pass
|
||||||
|
@ -18,5 +18,8 @@
|
|||||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
# DEALINGS IN THE SOFTWARE.
|
# DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
from hy.compilers import HyCompiler
|
||||||
|
|
||||||
|
|
||||||
|
class HyASTCompiler(HyCompiler):
|
||||||
|
pass
|
||||||
|
1
setup.py
1
setup.py
@ -37,6 +37,7 @@ setup(
|
|||||||
'hy',
|
'hy',
|
||||||
'hy.lex',
|
'hy.lex',
|
||||||
'hy.models',
|
'hy.models',
|
||||||
|
'hy.compilers',
|
||||||
],
|
],
|
||||||
author="Paul Tagliamonte",
|
author="Paul Tagliamonte",
|
||||||
author_email="tag@pault.ag",
|
author_email="tag@pault.ag",
|
||||||
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
0
tests/compilers/__init__.py
Normal file
0
tests/compilers/__init__.py
Normal file
28
tests/compilers/test_ast.py
Normal file
28
tests/compilers/test_ast.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Copyright (c) 2012 Paul Tagliamonte <paultag@debian.org>
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
# copy of this software and associated documentation files (the "Software"),
|
||||||
|
# to deal in the Software without restriction, including without limitation
|
||||||
|
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
# and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
# Software is furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
# DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
from hy.compilers.ast import HyASTCompiler
|
||||||
|
from hy.lex import tokenize
|
||||||
|
|
||||||
|
|
||||||
|
def test_ast_expression():
|
||||||
|
""" Test AST --> Expression conversion """
|
||||||
|
compiler = HyASTCompiler()
|
||||||
|
code = compiler.compile(tokenize("(foo bar)"))
|
0
tests/lex/__init__.py
Normal file
0
tests/lex/__init__.py
Normal file
Loading…
x
Reference in New Issue
Block a user