| 1 | //===-- TestOptions.cpp ---------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "lldb/Interpreter/Options.h" |
| 10 | #include "gtest/gtest.h" |
| 11 | |
| 12 | #include "llvm/Testing/Support/Error.h" |
| 13 | |
| 14 | using namespace lldb_private; |
| 15 | |
| 16 | TEST(OptionsTest, CreateOptionParsingError) { |
| 17 | ASSERT_THAT_ERROR( |
| 18 | CreateOptionParsingError("yippee" , 'f', "fun" , |
| 19 | "unable to convert 'yippee' to boolean" ), |
| 20 | llvm::FailedWithMessage("Invalid value ('yippee') for -f (fun): unable " |
| 21 | "to convert 'yippee' to boolean" )); |
| 22 | |
| 23 | ASSERT_THAT_ERROR( |
| 24 | CreateOptionParsingError("52" , 'b', "bean-count" ), |
| 25 | llvm::FailedWithMessage("Invalid value ('52') for -b (bean-count)" )); |
| 26 | |
| 27 | ASSERT_THAT_ERROR(CreateOptionParsingError("c" , 'm'), |
| 28 | llvm::FailedWithMessage("Invalid value ('c') for -m" )); |
| 29 | } |
| 30 | |