Suppress stderr noise when test case runs.

llvm-svn: 161085
This commit is contained in:
Nick Kledzik 2012-07-31 22:18:15 +00:00
parent f4cc61d525
commit 204720bc71
1 changed files with 6 additions and 0 deletions

View File

@ -16,11 +16,17 @@
namespace llvm {
static void SuppressDiagnosticsOutput(const SMDiagnostic &, void *) {
// Prevent SourceMgr from writing errors to stderr
// to reduce noise in unit test runs.
}
// Checks that the given input gives a parse error. Makes sure that an error
// text is available and the parse fails.
static void ExpectParseError(StringRef Message, StringRef Input) {
SourceMgr SM;
yaml::Stream Stream(Input, SM);
SM.setDiagHandler(SuppressDiagnosticsOutput);
EXPECT_FALSE(Stream.validate()) << Message << ": " << Input;
EXPECT_TRUE(Stream.failed()) << Message << ": " << Input;
}