start implementing parser
This commit is contained in:
parent
db2b4a142c
commit
fe4091da99
14
Test/TestParser.hs
Normal file
14
Test/TestParser.hs
Normal file
@ -0,0 +1,14 @@
|
||||
module TestParser(tests) where
|
||||
|
||||
import Test.HUnit
|
||||
import Parser.Lexer
|
||||
import Parser.JavaParser
|
||||
|
||||
|
||||
testIntLiteral = TestCase $ assertEqual "IntLiteral 34" [IntLiteral 34] $ parse (INTLITERAL 34)
|
||||
|
||||
testAnd = TestCase $ assertEqual "scan '&&'" [AND] $ alexScanTokens "&&"
|
||||
|
||||
tests = TestList [
|
||||
testIntLiteral
|
||||
]
|
@ -1,11 +1,13 @@
|
||||
module Main where
|
||||
|
||||
import Test.HUnit
|
||||
import Parser.Lexer
|
||||
import TestLexer
|
||||
-- import TestParser
|
||||
|
||||
otherTest = TestCase $ assertEqual "math" (4+3) 7
|
||||
|
||||
tests = TestList [TestLabel "TestLexer" TestLexer.tests, TestLabel "mathTest" otherTest]
|
||||
tests = TestList [
|
||||
TestLabel "TestLexer" TestLexer.tests
|
||||
-- TestLabel "TestParser" TestParser.tests
|
||||
]
|
||||
|
||||
main = do runTestTTAndExit Main.tests
|
@ -12,7 +12,7 @@ executable compiler
|
||||
default-language: Haskell2010
|
||||
hs-source-dirs: src
|
||||
build-tool-depends: alex:alex, happy:happy
|
||||
other-modules: Parser.Lexer, Ast
|
||||
other-modules: Parser.Lexer, Parser.JavaParser, Ast
|
||||
|
||||
test-suite tests
|
||||
type: exitcode-stdio-1.0
|
||||
@ -22,4 +22,8 @@ test-suite tests
|
||||
array,
|
||||
HUnit
|
||||
build-tool-depends: alex:alex, happy:happy
|
||||
other-modules: Parser.Lexer, TestLexer
|
||||
other-modules: Parser.Lexer,
|
||||
Parser.JavaParser,
|
||||
Ast,
|
||||
TestLexer
|
||||
TestParser
|
||||
|
Loading…
Reference in New Issue
Block a user