Files
swift-mirror/test/stdlib/StringTraps.swift
Dmitri Hrybenko 4814e00fda stdlib/String: implement Unicode extended grapheme cluster segmentation
algorithm

The implementation uses a specialized trie that has not been tuned to the table
data.  I tried guessing parameter values that should work well, but did not do
any performance measurements.

There is no efficient way to initialize arrays with static data in Swift.  The
required tables are being generated as C++ code in the runtime library.

rdar://16013860


Swift SVN r19340
2014-06-30 14:38:53 +00:00

39 lines
898 B
Swift

// These tests should crash.
// RUN: mkdir -p %t
// RUN: xcrun -sdk %target-sdk-name clang++ -arch %target-cpu %S/Inputs/CatchCrashes.cpp -c -o %t/CatchCrashes.o
// RUN: %target-build-swift %s -Xlinker %t/CatchCrashes.o -o %t/a.out
//
// RUN: %target-run %t/a.out StringCharacterStartIndexPredecessor 2>&1 | FileCheck %s -check-prefix=CHECK
// RUN: %target-run %t/a.out StringCharacterEndIndexSuccessor 2>&1 | FileCheck %s -check-prefix=CHECK
// CHECK: OK
// CHECK: CRASHED: SIG{{ILL|TRAP|ABRT}}
import Darwin
// Interpret the command line arguments.
var arg = Process.arguments[1]
if arg == "StringCharacterStartIndexPredecessor" {
var s = "abc"
var i = s.startIndex
++i
--i
println("OK")
--i
}
if arg == "StringCharacterEndIndexSuccessor" {
var s = "abc"
var i = s.startIndex
++i
++i
++i
println("OK")
++i
}
println("BUSTED: should have crashed already")
exit(1)