[Lldb-commits] [lldb] 5e538c6 - [LLDB] Add multi value test for const static enum
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 10 01:50:17 PDT 2022
Author: David Spickett
Date: 2022-08-10T08:50:12Z
New Revision: 5e538c669c76d26642f64cd03a6c09e5eee436b0
URL: https://github.com/llvm/llvm-project/commit/5e538c669c76d26642f64cd03a6c09e5eee436b0
DIFF: https://github.com/llvm/llvm-project/commit/5e538c669c76d26642f64cd03a6c09e5eee436b0.diff
LOG: [LLDB] Add multi value test for const static enum
1438639a2f7eb9e9cba01454d3a9b1b16d179c9a removed a test
that was using undefined behaviour setting a non-typed enum
to a value outside its known range.
That test also checked if we formatted the value properly
when it could contain >1 valid enum value.
I don't think there's anything special about how we format
typed vs non-typed enums so I'm adding a test for ScopedEnum
that will expect to see 2 enum values plus extra.
Reviewed By: labath, Michael137, shafik
Differential Revision: https://reviews.llvm.org/D131472
Added:
Modified:
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
Removed:
################################################################################
diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 794f382b8b68..594e67bd5156 100644
--- a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -56,8 +56,11 @@ def test(self):
# Test a scoped enum.
self.expect_expr("A::scoped_enum_val", result_value="scoped_enum_case2")
- # Test an scoped enum with an invalid enum case.
- self.expect_expr("A::invalid_scoped_enum_val", result_value="scoped_enum_case1 | 0x4")
+ # Test an scoped enum with a value that isn't an enumerator.
+ self.expect_expr("A::not_enumerator_scoped_enum_val", result_value="scoped_enum_case1 | 0x4")
+ # This time with more than one enum value plus the extra.
+ self.expect_expr("A::not_enumerator_scoped_enum_val_2",
+ result_value="scoped_enum_case1 | scoped_enum_case2 | 0x4")
# Test an enum with fixed underlying type.
self.expect_expr("A::scoped_char_enum_val", result_value="case2")
diff --git a/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp b/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
index 17b14da864a9..977e12295760 100644
--- a/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
+++ b/lldb/test/API/lang/cpp/const_static_integral_member/main.cpp
@@ -48,7 +48,9 @@ struct A {
const static Enum enum_val = enum_case2;
const static ScopedEnum scoped_enum_val = ScopedEnum::scoped_enum_case2;
- const static ScopedEnum invalid_scoped_enum_val = static_cast<ScopedEnum>(5);
+ const static ScopedEnum not_enumerator_scoped_enum_val = static_cast<ScopedEnum>(5);
+ const static ScopedEnum not_enumerator_scoped_enum_val_2 =
+ static_cast<ScopedEnum>(7);
const static ScopedCharEnum scoped_char_enum_val = ScopedCharEnum::case2;
const static ScopedLongLongEnum scoped_ll_enum_val_neg =
ScopedLongLongEnum::case0;
@@ -102,7 +104,7 @@ int main() {
Enum e = A::enum_val;
ScopedEnum se = A::scoped_enum_val;
- se = A::invalid_scoped_enum_val;
+ se = A::not_enumerator_scoped_enum_val;
ScopedCharEnum sce = A::scoped_char_enum_val;
ScopedLongLongEnum sle = A::scoped_ll_enum_val;
More information about the lldb-commits
mailing list