From 593488257693d0828051418d4a958219d31d3d73 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 19 May 2017 22:37:13 +0000 Subject: [PATCH] [compiler-rt] Add negative test for boolean flags. Reviewers: eugenis, alekseyshl Subscribers: kubamracek, dberris, llvm-commits Differential Revision: https://reviews.llvm.org/D33344 llvm-svn: 303462 --- compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc b/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc index 24a3f3d..d510a35 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_flags_test.cc @@ -59,6 +59,14 @@ TEST(SanitizerCommon, BooleanFlags) { TestFlag(true, "flag_name=0", false); TestFlag(true, "flag_name=no", false); TestFlag(true, "flag_name=false", false); + + EXPECT_DEATH(TestFlag(false, "flag_name", true), "expected '='"); + EXPECT_DEATH(TestFlag(false, "flag_name=", true), + "Invalid value for bool option: ''"); + EXPECT_DEATH(TestFlag(false, "flag_name=2", true), + "Invalid value for bool option: '2'"); + EXPECT_DEATH(TestFlag(false, "flag_name=-1", true), + "Invalid value for bool option: '-1'"); } TEST(SanitizerCommon, IntFlags) { -- 2.7.4