Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / test / ParserTests.cpp
diff options
context:
space:
mode:
Commit4c31ba3bfe9ab51ee25d02f008df848e24f21a98 (patch)
Author
 dtrendafilov <trendafilov.dn@gmail.com>
2018-10-29 21:27:21 +0200
Committer
 GitHub <noreply@github.com>
2018-10-29 21:27:21 +0200
Files186f366fd86d4ae634a6e21751875a1e7b8f276d /JSImpl/test/ParserTests.cpp
IPL-4c31ba3bfe9ab51ee25d02f008df848e24f21a98.tar
IPL-4c31ba3bfe9ab51ee25d02f008df848e24f21a98.tar.gz
IPL-4c31ba3bfe9ab51ee25d02f008df848e24f21a98.zip
Parent806d126b79229ebd36023ca1dd4baae7b520c67f (diff)
Parentf747ef432192c2742ef8fd29496c117290240369 (diff)
Merge pull request #29 from SofiaCPP/testing
Testing
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());
+}
+