From 9983be7cfefde49b801763ead0a331c8eaac134b Mon Sep 17 00:00:00 2001 From: Cyril Lashkevich Date: Sun, 11 Mar 2018 12:43:38 +0100 Subject: [PATCH] Added unittest with surogate character --- Tests/LinuxMain.swift | 3 ++- .../IdentifierNameRuleTests.swift | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift index 14ee5fb05..811e5c5ee 100644 --- a/Tests/LinuxMain.swift +++ b/Tests/LinuxMain.swift @@ -205,7 +205,8 @@ extension IdentifierNameRuleTests { ("testIdentifierName", testIdentifierName), ("testIdentifierNameWithAllowedSymbols", testIdentifierNameWithAllowedSymbols), ("testIdentifierNameWithAllowedSymbolsAndViolation", testIdentifierNameWithAllowedSymbolsAndViolation), - ("testIdentifierNameWithIgnoreStartWithLowercase", testIdentifierNameWithIgnoreStartWithLowercase) + ("testIdentifierNameWithIgnoreStartWithLowercase", testIdentifierNameWithIgnoreStartWithLowercase), + ("testLinuxCrashOnEmojiNames", testLinuxCrashOnEmojiNames) ] } diff --git a/Tests/SwiftLintFrameworkTests/IdentifierNameRuleTests.swift b/Tests/SwiftLintFrameworkTests/IdentifierNameRuleTests.swift index a2d0a590a..8d5b4965b 100644 --- a/Tests/SwiftLintFrameworkTests/IdentifierNameRuleTests.swift +++ b/Tests/SwiftLintFrameworkTests/IdentifierNameRuleTests.swift @@ -53,4 +53,14 @@ class IdentifierNameRuleTests: XCTestCase { verifyRule(description, ruleConfiguration: ["validates_start_with_lowercase": false]) } + + func testLinuxCrashOnEmojiNames() { + let baseDescription = IdentifierNameRule.description + let triggeringExamples = [ + "let 👦🏼 = \"👦🏼\"" + ] + + let description = baseDescription.with(triggeringExamples: triggeringExamples) + verifyRule(description, ruleConfiguration: ["allowed_symbols": ["$", "%"]]) + } }