Commit Graph

47 Commits

Author SHA1 Message Date
Kuba (Brecka) Mracek
15400c3ef7 Set build-swift-stdlib-unicode-data=0 for the freestanding preset (#41258) 2022-02-08 12:31:49 -08:00
Max Desiatov
372ada0e24 test: add handling for Wasm/WASI (#39519)
This change adds support for WASI in stdlib tests. Some tests that expect a crash to happen had to be disabled, since there's currently no way to observe such crash from a WASI host.
2022-01-12 14:24:50 +00:00
Butta
2890d15da7 [build] Remove last vestiges of ICU for anything other than Foundation 2021-12-25 21:16:34 +05:30
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Stephen Canon
dc5915cdb5 Replace stdlib and test/stdlib 9999 availability. (#26108)
* Replace stdlib and test/stdlib 9999 availability.

macOS 9999 -> macOS 10.15
iOS 9999 -> iOS 13
tvOS 9999 -> tvOS 13
watchOS 9999 -> watchOS 6

* Restore the pre-10.15 version of public init?(_: NSRange, in: __shared String)

We need this to allow master to work on 10.14 systems (in particular, to allow PR testing to work correctly without disabling back-deployment tests).
2019-07-12 16:30:36 -04:00
Michael Ilseman
aa519362f3 [String] Add Character.UTF16View and Character.UTF8View
Adds these collections, which are just String's views.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
751cf26ef5 [Unicode.Scalar] Add RAC UTF8View
This adds new (availability-controlled) API to Unicode.Scalar,
exposing the scalar's UTF-8 code units as a random-access collection
similarly to how it currently exposes UTF-16 code units.

Tests added.
2019-03-29 15:43:00 -07:00
Michael Ilseman
863b4979b5 [test] Disable new emoji testing on Linux 2018-11-08 16:19:27 -08:00
Michael Ilseman
0ca620a994 [test] Adjust tests to run on older OSes.
Version-gate newer emoji in test, and adjust a simple CHECK line.
2018-11-07 15:32:56 -08:00
Karoy Lorentey
40aae6b235 [String] 32-bit platform support
Add support for 32-bit platforms for UTF-8 backed String.
2018-11-04 10:42:41 -08:00
Michael Ilseman
e6582c37ee [test] Adjust String tests for UTF-8 representation.
Adjust tests for the UTF-8 representation, in preparation for 32-bit
support. Includes UTF-8 literal update.
2018-11-04 10:42:41 -08:00
Mark Lacey
f14942646d Remove unused typealias. 2018-10-25 17:14:15 -07:00
Mark Lacey
958ee1a82b Add more type checker performance tests.
Also move one from fast to slow based on the fact that it wasn't
representative of the original issue (which was an expression that
didn't typecheck successfully).
2018-10-25 16:21:17 -07:00
Michael Ilseman
ced2e63d95 [test] Make string internal testing a little more robust; NFC
Add an isSmall query to Character so testing doesn't have to bake in
internal format. Clarify the purpose of the invalid UTF-16 backdoor
creation method.
2018-08-02 16:34:19 -07:00
Michael Ilseman
ba6158d74e [test] Internalize _StringGuts; Add shared testing struct; NFC
Create a _StringRepresentation struct to standardize internal testing
on. Internalize much of _StringGuts, except for some SPI hacks, and
update tests to use _StringRepresentation.
2018-08-01 14:23:56 -07:00
Ben Rimmington
2f326bcc88 [stdlib] Remove theGlobalMT19937
SwiftPrivate/PRNG.swift:

- currently uses `theGlobalMT19937`;
- previously used `arc4random` (see #1939);
- is obsoleted by SE-0202: Random Unification.
2018-08-01 13:00:16 +01:00
Michael Ilseman
6c03cea1ca [test] Guard OS-dependent Unicode behavior with check 2018-06-28 14:57:27 -07:00
Karoy Lorentey
b360bd6d69 Remove _LegacyStringCore 🎉🎉🎉 2018-01-21 12:35:15 -08:00
Ben Cohen
dcab9493ae Removed some warnings (#12753) 2017-11-30 15:12:56 -08:00
Dave Abrahams
562fd79aa6 [stdlib] Encode small Characters as UTF-16
This takes care of the standard library portion, but we need a new
BuiltinUTF16ExtendedGraphemeClusterLiteralConvertible protocol in order to
fully recover the performance of character literals.

Note that part of the character_literals.swift test is currently disabled.  That
will need to be fixed before we can merge this work.
2017-06-01 20:57:25 -07:00
Michael Ilseman
a3a6a8a0a1 [stdlib] Disable Unicode 9 test on Linux, depends on ICU version 2017-05-16 20:30:03 -07:00
Michael Ilseman
698b120c70 [stdlib] Add Unicode 9 grapheme break tests for flags, emoji, etc. 2017-05-16 20:30:02 -07:00
Dave Abrahams
ef5d37c4fa [stdlib] Character.unicodeScalars 2017-05-16 14:29:55 -07:00
Michael Ilseman
f0abff5539 Revert "Merge pull request #9265 from milseman/tls_ftw"
This reverts commit 26f7659efe, reversing
changes made to 7b927e55e8.
2017-05-11 10:39:58 -07:00
Michael Ilseman
7a05d867e5 [stdlib] Disable Unicode 9 test on Linux, depends on ICU version 2017-05-10 15:25:24 -07:00
Michael Ilseman
6903dd3256 [stdlib] Add Unicode 9 grapheme break tests for flags, emoji, etc. 2017-05-10 15:21:09 -07:00
Michael Ilseman
fa61a665c5 [stdlib] Fix relative-offset computing bug in grapheme breaking.
Many of StringCore private APIs, when the StringCore is itself a
substring, expect relative offsets rather than absolute offsets. This
fixes a bug in the sub-0x300 fast path where we were using absolute
offsets. Test cases added.
2017-04-25 16:51:35 -07:00
Michael Ilseman
2d8164e552 [stdlib] Parse my tweets faster! 2x forwards, 3x reverse
Adds in a special case grapheme break detection between two values
within scalar ranges where we have special knowledge. Any sub-0x300
scalars, except CR-LF, are guaranteed to have grapheme breaks between
them. We're reasonably confident this will not change in future
versions of Unicode. We might add more ranges in the future, but
should do so conservatively, anticipating future Unicode changes.

In these cases we can very quickly break, even for strings that have
mixed latin and emoji characters. In a ASCII string with a single
emoji in it, we traverse the string 2x faster forwards and 3x faster
in reverse. (Reverse is 3x faster as it involves some forwards
traversal inside of the index). For a string that's half Latin half
non-Latin, we're about 1.5x faster forwards and backwards.
2017-04-24 15:17:25 -07:00
Michael Ilseman
8b5777fdd2 [stdlib] Bug fix in reverse ASCII grapheme breaking
Fix a bug using wrong index calculations in the ASCII grapheme
breaking fast path. Add new test case.
2017-04-20 16:22:18 -07:00
airspeedswift
33f1e11f7b numbered Character size ABI FIXME (#5038) 2016-09-28 11:11:17 -07:00
Dmitri Gribenko
39a3a1fb43 Eliminate boilerplate from stdlib tests 2016-09-15 10:20:09 -07:00
Dmitri Gribenko
75fa0bf588 stdlib: add an ABI FIXME 2016-09-15 00:57:19 -07:00
Max Moiseev
9fc37efee4 [test] renaming test/1_stdlib to just test/stdlib 2016-09-01 16:51:43 -07:00
Jordan Rose
e83c117c30 [test] Hack: run stdlib tests first to start long-running tests earlier.
This decreases total testing time by over a minute on my old Mac Pro.
It probably has much less effect on systems with fewer cores, but shouldn't
be any worse there.

Swift SVN r22745
2014-10-15 01:30:51 +00:00
Dave Abrahams
57367877c4 [stdlib] Make 'Character' a struct
It used to be a public enum, which unnecessarily exposed structure that
was intended to be private implementation detail.  This change also has
the benefit that converting a String to a Character will avoid
allocating memory in many more cases.

Swift SVN r22629
2014-10-09 18:25:25 +00:00
Dave Abrahams
156020de19 [stdlib] Rename 'countElements' => 'count'
The name was not only long and unwieldy, but inconsistent with our
conscious decision to avoid the use of "elements" in APIs as mostly
redundant.

Swift SVN r22408
2014-09-30 22:00:26 +00:00
Jordan Rose
1c0d8c9c13 [test] Add an interpreter mode to the tests.
This takes all %target-run-simple-swift and %target-run-stdlib-swift
invocations and runs them using the interpreter instead. To enable this
mode, pass --param=interpret to lit.py; you can add this flag to the
LLVM_LIT_ARGS CMake setting (which defaults to "-sv").

This doesn't support separated %target-build / %target-run steps, nor
does it work with StdlibUnittest (which uses posix_spawn to run its
subtasks). But it's a start.

<rdar://problem/17938202>

Swift SVN r21391
2014-08-21 23:50:15 +00:00
Dmitri Hrybenko
8cca039e62 StdlibUnittest: rename TestCase to TestSuite since it contains multiple tests
Thanks, Ben!


Swift SVN r21222
2014-08-15 00:09:58 +00:00
Dmitri Hrybenko
938e7c2676 stdlib: introduce UnicodeScalarLiteralConvertible protocol
This allows UnicodeScalars to be constructed from an integer, rather
then from a string.  Not only this avoids an unnecessary memory
allocation (!) when creating a UnicodeScalar, this also allows the
compiler to statically check that the string contains a single scalar
value (in the same way the compiler checks that Character contains only
a single extended grapheme cluster).

rdar://17966622

Swift SVN r21198
2014-08-14 16:04:39 +00:00
Dmitri Hrybenko
f2436065db StdlibUnittest: run tests out of process
The test harness now can recover after test crashes, allowing:

- check for crashes themselves (without reporting them to the Python lit driver,
  which is about 10x slower -- even if CrashTracer is disabled);

- recover from unexpected test crashes and run the rest of the tests;

- this lays the groundwork for assertions that end the test execution, but
  allow the rest of the tests to run (rdar://17906801).

Note that we don't spawn a fresh process for every test.  We create a child
process and reuse it until it crashes.


Swift SVN r21090
2014-08-07 15:14:57 +00:00
Dmitri Hrybenko
eff383932c stdlib/Character: add Hashable conformance
Swift SVN r20539
2014-07-25 10:32:00 +00:00
Dmitri Hrybenko
9302423c3d stdlib/Character: trap when trying to construct a Character from more
than one grapheme cluster

Swift SVN r20535
2014-07-25 10:06:18 +00:00
Chris Lattner
287059b360 implement <rdar://problem/17279286> Swift has too many Unicode escape sequence forms
This consolidates the \x, \u, and \U escape sequences into one \u{abc} escape sequence.
For now we still parse and cleanly reject the old forms with a nice error message, this
will eventually be removed in a later beta (tracked by rdar://17527814)


Swift SVN r19435
2014-07-01 23:27:44 +00:00
Chris Lattner
70076cf958 switch the testsuite to use the ..< operator instead of ..
Swift SVN r19003
2014-06-19 17:18:23 +00:00
Ted Kremenek
9eea282719 Switch range operators ".." and "...".
- 1..3 now means 1,2
- 1...3 now means 1,2,3

Implements <rdar://problem/16839891>

Swift SVN r18066
2014-05-14 07:36:00 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dave Abrahams
b5842cb6b4 [stdlib] Initial implementation of Character
This type can't do much but store an arbitrary very short string right now, but it works

Swift SVN r8850
2013-10-02 18:56:19 +00:00