Commit Graph

25 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
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Karoy Lorentey
b7eb2fced0 [test] Substring: remove unnecessary expected arguments
The previous commit made these redundant.
2020-01-24 16:41:47 -08:00
Karoy Lorentey
147087ca43 [test] Adjust new Substring test
We don’t have an easy way to check for the runtime version of the stdlib, so a two-way check for behavioral changes isn’t feasible. (Checking for the OS version isn’t good enough.)

Only check for the new behavior, and only when we know for sure that it’s available.
2020-01-24 16:40:44 -08:00
Cory Benfield
c6dfea6fc4 [stdlib] Re-add withContiguousStorageIfAvailable to SubString.UTF8View
This is a second pass at the original patch, which broke an OS test.

Due to an oversight it seems that we never added a
withContigousStorageIfAvailable implementation to SubString.UTF8View,
which meant that if you sliced a String you lost the ability to get fast
access to the backing storage. There's no good reason for this
functionality to be missing, so this patch adds it in by delegating to
the Slice implementation.

Resolves SR-11999.
2020-01-14 14:01:06 +00:00
Michael Ilseman
70e6db81f1 Revert "[stdlib] Add withContiguousStorageIfAvailable to SubString.UTF8View" 2020-01-10 13:28:03 -08:00
Cory Benfield
68f0816daa [stdlib] Add withContiguousStorageIfAvailable to SubString.UTF8View
Due to an oversight it seems that we never added a
withContigousStorageIfAvailable implementation to SubString.UTF8View,
which meant that if you sliced a String you lost the ability to get fast
access to the backing storage. There's no good reason for this
functionality to be missing, so this patch adds it in by delegating to
the Slice implementation.

Resolves SR-11999.
2020-01-10 09:10:09 +00:00
Michael Ilseman
0ece62d911 [String] Add Substring.base
Adds Substring.base, analogous to Slice.base, to access the entire
String.

Tests added.
2019-03-29 15:43:00 -07:00
Jordan Rose
38b3c25b15 [test] XFAIL some String tests on older Apple OSs 2018-10-03 16:54:38 -07:00
Ben Cohen
83823f5f7f [stdlib] Obsolete various compatibility shims in 5.0 (#19008)
* Obsolete ModifierSlice typealiases in 5.0

* Obsolete *Indexable in 5.0

* Obsolete IteratorOverOne/EmptyIterator in 5.0

* Obsolete lazy typealiases in 5.0

* Drop .characters from tests

* Obsolete old literal protocols in 5.0

* Obsolete Range conversion helpers in 5.0

* Obsolete IndexDistance helpers in 5.0

* Obsolete Unsafe compat helpers in 5.0

* Obsolete flatMap compatibility helper in 5.0

* Obsolete withMutableCharacters in 5.0

* Obsolete customPlaygroundQuickLook in 5.0

* Deprecate Zip2Sequence streams in 5.0

* Replace * with swift on lotsa stuff

* Back off obsoleting playground conformances for now
2018-08-28 13:20:25 -07:00
Michael Ilseman
00e214ec50 [string] Clean up String.UTF8View
Extract slow paths into non-inlinable functions so that fast-paths can
be faster and we don't pay the large code bloat for the Unicode
parsers.

Some tests proactively extended to highlight UTF8View of multiple
kinds of Strings.
2018-05-14 07:01:38 -07:00
Nate Cook
58933d88c5 [stdlib] Rename index(...) methods to firstIndex(...)
A la SE-204.
2018-04-21 18:07:25 -05:00
Lance Parker
37807731a1 test additive mutations too 2018-01-31 17:20:56 -08:00
Lance Parker
084c46c5e0 Test 2018-01-31 16:54:34 -08:00
Michael Ilseman
10e9e336fe [stdlib] Fix bug in Substring's _persistentContent
Substring's _persistentContent has a fast path that avoids a copy when
the Substring represents the entire outer String. It correctly
detected situations where the wrapped _StringCore was not itself a
slice, but was omitting the extra checks to make sure the Substring's
own range covered the entire String.

Test added.
2017-07-25 14:28:57 -07:00
Ben Cohen
ddea636951 [stdlib] Have Substring.filter return a String (#10871)
* Have Substring.filter return a String

* fix spacing nits

new machine so editor misconfigured excuses excuses

* fix spacing nits
2017-07-24 15:23:30 -07:00
Ben Cohen
d0c0043f93 [stdlib] Use ephemeral string for substring comparison (#10009)
* Use _ephemeralString for substring comparison

Add back != for String/Substring comparison

* OK fine, Linux, if you're going to be difficult

* Different forms of comparison, tests
2017-06-03 11:20:01 -07:00
Nate Cook
c2bc72d9d6 [stdlib] Fix string index sharing (#4896)
* [stdlib] Fix String.UTF16View index sharing

* [stdlib] Fix String.UnicodeScalarView index sharing

* [stdlib] Fix String.CharacterView index sharing

* [stdlib] Test advancing string indices past their ends

* [stdlib] Simplify CharacterView ranged subscript
2016-10-13 10:19:38 -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
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
Dmitri Hrybenko
6a403387e8 Move some interpreter-based tests that test stdlib from test/ to test/stdlib/
Swift SVN r7705
2013-08-29 00:13:23 +00:00