Skip to content

Commit 94f4704

Browse files
committed
X3.Tests: expect: actually test exception info
1 parent 945eb97 commit 94f4704

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

test/x3/expect.cpp

+14-10
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ main()
3838
}
3939
catch (expectation_failure<char const*> const& x)
4040
{
41-
std::cout << "expected: " << x.which();
42-
std::cout << " got: \"" << x.where() << '"' << std::endl;
41+
BOOST_TEST_CSTR_EQ(x.which().c_str(), "'o'");
42+
BOOST_TEST_CSTR_EQ(x.where(), "i");
4343
}
4444
}
4545

@@ -55,8 +55,8 @@ main()
5555
}
5656
catch (expectation_failure<char const*> const& x)
5757
{
58-
std::cout << "expected: " << x.which();
59-
std::cout << " got: \"" << x.where() << '"' << std::endl;
58+
BOOST_TEST_CSTR_EQ(x.which().c_str(), "'o'");
59+
BOOST_TEST_CSTR_EQ(x.where(), "i");
6060
}
6161
}
6262

@@ -67,8 +67,12 @@ main()
6767
}
6868
catch (expectation_failure<char const*> const& x)
6969
{
70-
std::cout << "expected: " << x.which();
71-
std::cout << " got: \"" << x.where() << '"' << std::endl;
70+
#ifndef BOOST_SPIRIT_X3_NO_RTTI
71+
BOOST_TEST(x.which().find("sequence") != std::string::npos);
72+
#else
73+
BOOST_TEST_CSTR_EQ(x.which().c_str(), "undefined");
74+
#endif
75+
BOOST_TEST_CSTR_EQ(x.where(), "y:a");
7276
}
7377
}
7478

@@ -128,8 +132,8 @@ main()
128132
}
129133
catch (expectation_failure<char const*> const& x)
130134
{
131-
std::cout << "expected: " << x.which();
132-
std::cout << " got: \"" << x.where() << '"' << std::endl;
135+
BOOST_TEST_CSTR_EQ(x.which().c_str(), "'o'");
136+
BOOST_TEST_CSTR_EQ(x.where(), "i");
133137
}
134138
}
135139

@@ -140,8 +144,8 @@ main()
140144
}
141145
catch (expectation_failure<char const*> const& x)
142146
{
143-
std::cout << "expected: " << x.which();
144-
std::cout << " got: \"" << x.where() << '"' << std::endl;
147+
BOOST_TEST_CSTR_EQ(x.which().c_str(), "\"foo\"");
148+
BOOST_TEST_CSTR_EQ(x.where(), "bar");
145149
}
146150
}
147151

0 commit comments

Comments
 (0)