forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3241 from adrian-prantl/82537719
Remove unnecessary assertion and add a testcase.
- Loading branch information
Showing
4 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SWIFT_SOURCES := main.swift | ||
|
||
include Makefile.rules |
22 changes: 22 additions & 0 deletions
22
lldb/test/API/lang/swift/enum_as_value/TestSwiftEnumAsValue.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
import lldbsuite.test.lldbtest as lldbtest | ||
import lldbsuite.test.lldbutil as lldbutil | ||
import unittest2 | ||
|
||
|
||
class TestSwiftAnyType(lldbtest.TestBase): | ||
|
||
mydir = lldbtest.TestBase.compute_mydir(__file__) | ||
|
||
@swiftTest | ||
def test_any_type(self): | ||
self.build() | ||
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( | ||
self, 'Set breakpoint here', lldb.SBFileSpec('main.swift')) | ||
|
||
frame = thread.frames[0] | ||
var_e = frame.FindVariable("e") | ||
# We don't have an encoding for enums. | ||
self.assertEqual(var_e.GetValueAsSigned(0xdead), 0xdead) | ||
self.assertEqual(var_e.GetValue(), 'B') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
enum E { | ||
case A | ||
case B | ||
} | ||
func main(_ e: E) { | ||
print(e) // Set breakpoint here | ||
} | ||
|
||
main(.B) | ||
|