summaryrefslogtreecommitdiff
path: root/test/gtest/print-test.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/gtest/print-test.h')
-rw-r--r--test/gtest/print-test.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/gtest/print-test.h b/test/gtest/print-test.h
new file mode 100644
index 000000000..9815c18bb
--- /dev/null
+++ b/test/gtest/print-test.h
@@ -0,0 +1,28 @@
+#include <iostream>
+
+#include "support/colors.h"
+#include "wasm-s-parser.h"
+#include "wasm.h"
+#include "gtest/gtest.h"
+
+#ifndef wasm_test_gtest_print_test_h
+#define wasm_test_gtest_print_test_h
+
+// Helper test fixture for parsing wast and checking some printed output.
+class PrintTest : public ::testing::Test {
+ bool colors = Colors::isEnabled();
+
+public:
+ PrintTest() { Colors::setEnabled(false); }
+
+protected:
+ void TearDown() override { Colors::setEnabled(colors); }
+
+ void parseWast(wasm::Module& wasm, const std::string& wast) {
+ wasm::SExpressionParser parser(wast.c_str());
+ wasm::SExpressionWasmBuilder builder(
+ wasm, *(*parser.root)[0], wasm::IRProfile::Normal);
+ }
+};
+
+#endif