Xcode7 (Swift): Record UI Test: Generates invalid string escape sequences
| Originator: | martina | ||
| Number: | rdar://22785848 | Date Originated: | 21-Sep-2015 |
| Status: | Duplicate of 22602161 (Open) | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7.0 (7A220) |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
When a button title contains Unicode characters outside the ASCII range, e.g. "Ü" (U+00DC), "Record UI Test" generates invalid escape sequences:
a) the generated Unicode escape sequence uses an uppercase U, but Unicode escape sequences start with a lowercase u in Swift
b) the hexadecimal representation of the Unicode character should be enclosed in braces ("{}"), but isn't
Steps to Reproduce:
Preparation:
1. Install Xcode 7
2. Create a new Swift project: iOS: Application: Single View Application
3. On Main.storyboard, place a single UIButton
4. Change the button title to "Ümlaut".
Steps:
5. In the UI Tests Target, place cursor in the testExample function
6. Start Recording UI Test
7. Click the button
8. Stop Recording UI Test
9. Observe generated code and compile
Expected Results:
XCUIApplication().buttons["\Ümlaut"].tap()
- OR -
XCUIApplication().buttons["\u{00dc}mlaut"].tap()
No compilation errors.
Actual Results:
XCUIApplication().buttons["\U00dcmlaut"].tap()
Resulting in a compilation error: Invalid escape sequence in literal
Version:
Xcode 7.0 (7A220)
OS X 10.10.5 (14F27)
Notes:
Configuration:
I would prefer if you wouldn't try to convert the Unicode character to escape sequences at all. Just leave it as is, this is much more readable.
Attachments:
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!