From e89ae67ea4d71912caef286d3b4dcc3a5a64d134 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Sun, 28 Oct 2018 18:47:12 +0200 Subject: Moved lexer and parser tests to the test app --- JSImpl/test/ParserTests.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 JSImpl/test/ParserTests.cpp (limited to 'JSImpl/test/ParserTests.cpp') diff --git a/JSImpl/test/ParserTests.cpp b/JSImpl/test/ParserTests.cpp new file mode 100644 index 0000000..a884f37 --- /dev/null +++ b/JSImpl/test/ParserTests.cpp @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +#include + +#include + +TEST(Parser, ParseUnaryExpr) +{ + IPLVector tokens; + Tokenize("function pesho() { var a = 0; return a; } var a = \"3\";", tokens); + + // TODO make actual test :D + auto expr = Parse(tokens); + std::ostringstream output; + ASTPrinter p(output); + expr->Accept(p); + ASSERT_TRUE(!output.str().empty()); +} + -- cgit v1.3.1-23-gd82d