File: print-test.h

package info (click to toggle)
binaryen 120-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 41,284 kB
  • sloc: cpp: 189,449; javascript: 62,189; ansic: 14,087; python: 5,379; pascal: 441; sh: 77; makefile: 30; asm: 27
file content (29 lines) | stat: -rw-r--r-- 704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>

#include "parser/wat-parser.h"
#include "support/colors.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) {
    auto parsed = wasm::WATParser::parseModule(wasm, wast);
    if (auto* err = parsed.getErr()) {
      wasm::Fatal() << err->msg << "\n";
    }
  }
};

#endif