Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / test / ParserTests.cpp
diff options
context:
space:
mode:
1 files changed, 22 insertions, 0 deletions
-rw-r--r--JSImpl/test/ParserTests.cpp22
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 <src/CommonTypes.h>
+#include <src/Lexer.h>
+#include <src/Parser.h>
+#include <src/ASTPrinter.h>
+
+#include <gtest/gtest.h>
+
+#include <sstream>
+
+TEST(Parser, ParseUnaryExpr)
+{
+ IPLVector<Token> 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());
+}
+