NewLang Project
Yet another programm language
Loading...
Searching...
No Matches
diag_test.cpp
Go to the documentation of this file.
1#ifdef BUILD_UNITTEST
2
3#include "warning_push.h"
4#include <gtest/gtest.h>
5#include "warning_pop.h"
6
7#include "term.h"
8#include "diag.h"
9
10using namespace newlang;
11
12TEST(Diag, Init) {
13
14}
15
16
17TEST(Diag, State) {
18 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::flag, Diag::State::option).c_str());
19 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::flag, Diag::State::ignored).c_str());
20 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::flag, Diag::State::error).c_str());
21 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::flag, Diag::State::warning).c_str());
22
23 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::option, Diag::State::option).c_str());
24 EXPECT_STREQ("-Wno-foo", Diag::ChangeState("-Wfoo", Diag::State::option, Diag::State::ignored).c_str());
25 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::option, Diag::State::error).c_str());
26 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::option, Diag::State::warning).c_str());
27
28 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::ignored, Diag::State::option).c_str());
29 EXPECT_STREQ("-Wno-foo", Diag::ChangeState("-Wfoo", Diag::State::ignored, Diag::State::ignored).c_str());
30 EXPECT_STREQ("-Werror=foo", Diag::ChangeState("-Wfoo", Diag::State::ignored, Diag::State::error).c_str());
31 EXPECT_STREQ("-Wno-error=foo", Diag::ChangeState("-Wfoo", Diag::State::ignored, Diag::State::warning).c_str());
32
33 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::warning, Diag::State::option).c_str());
34 EXPECT_STREQ("-Wno-foo", Diag::ChangeState("-Wfoo", Diag::State::warning, Diag::State::ignored).c_str());
35 EXPECT_STREQ("-Werror=foo", Diag::ChangeState("-Wfoo", Diag::State::warning, Diag::State::error).c_str());
36 EXPECT_STREQ("-Wno-error=foo", Diag::ChangeState("-Wfoo", Diag::State::warning, Diag::State::warning).c_str());
37
38 EXPECT_STREQ("-Wfoo", Diag::ChangeState("-Wfoo", Diag::State::error, Diag::State::option).c_str());
39 EXPECT_STREQ("-Wno-foo", Diag::ChangeState("-Wfoo", Diag::State::error, Diag::State::ignored).c_str());
40 EXPECT_STREQ("-Werror=foo", Diag::ChangeState("-Wfoo", Diag::State::error, Diag::State::error).c_str());
41 EXPECT_STREQ("-Wno-error=foo", Diag::ChangeState("-Wfoo", Diag::State::error, Diag::State::warning).c_str());
42}
43
44
45#endif // UNITTEST
Definition nlc.h:59