Instead of trying to bridge NSDictionary to [String:String], XCTest needs to
just request the objects from the NSDictionary as String.
Also, move the unwrapping of the optional from the might-throw block such that
it only happens when the block hasn't thrown. Unwrapping the optional if the
block has thrown would crash, because the optional would still be unset.
Addresses <rdar://problem/17952584>.
Swift SVN r21119
The SPI that XCTest exposes to the overlay has Objective-C semantics,
while anything exposed to Swift code via @asmname needs Swift semantics.
Add a bridge to the overlay that handles this adaptation.
Addresses <rdar://problem/17408423>.
Swift SVN r20932
Rather than use a header file and -import-objc-header, use @asmname and
@objc_block to tell the overlay about the Objective-C function used to
capture exceptions.
Further addresses <rdar://problem/16453199>.
Swift SVN r20929
Since Swift itself has no exception support, use an Objective-C helper function
to evaluate a block and return an NSDictionary indicating whether an exception
was thrown out of that block (and if so, which exception).
Addresses <rdar://problem/16453199>.
Swift SVN r20880
Now that CGFloat is a peer of Float and Double, we need to add appropriate handling
to it for XCTAssertEqualWithAccuracy.
Addresses <rdar://problem/17762421>.
Swift SVN r20800
Now that Swift has an access control model, we need to apply it to the XCTest overlay.
This is handy in that it lets us hide some implementation details of the overlay.
Addresses <rdar://problem/17653535>.
Swift SVN r19989
Mechanically add "Type" to the end of any protocol names that don't end
in "Type," "ible," or "able." Also, drop "Type" from the end of any
associated type names, except for those of the *LiteralConvertible
protocols.
There are obvious improvements to make in some of these names, which can
be handled with separate commits.
Fixes <rdar://problem/17165920> Protocols `Integer` etc should get
uglier names.
Swift SVN r19883
When asking XCTest to generate format strings for assertions, pass the
requested index + 100 to ask XCTest to generate a string without space
for the expressions themselves, and don't bother passing them either
(since the overlay isn't actually generating stringified expressons).
Addresses <rdar://problem/17597526>.
Swift SVN r19712
Previously, bridged value types and their corresponding Objective-C
classes allow inter-conversion via a number of user-defined conversion
functions in the Foundation module. Instead, make this a general
feature of the type checker so we can reason about it more
directly. Fixes <rdar://problem/16956098> and
<rdar://problem/17134986>, and eliminates 11 (half) of the
__conversion functions from the standard library and overlays.
A few notes:
- The XCTest changes are because a String can no longer directly
conform to CVarArg: this is a Good Thing (TM), because it should be
ambiguous: did you mean to pass it as an NSString or a C string?
- The Objective-C representations for the bridged collections are
hard-coded in the type checker. This is unfortunate and can be
remedied by adding another associated type to the
_BridgedToObjectiveC protocol.
Swift SVN r19618
COMPILE_FLAGS is currently used for two purposes:
- For any target library, add the appropriate Swift optimization flags. This eliminates the add_swift_optimization_flags boilerplate and makes these flags work for all library variants
- For the runtime, pass the appropriate define down when SWIFT_RUNTIME_CLOBBER_FREED_OBJECTS is set, so that all library variants get this setting.
Swift SVN r19444
We need to actually keep the XCTest support in an overlay for now.
This reverts commit 4a2726862634a553483943baf39a251ac8071e37.
Addresses <rdar://problem/17423669>.
Swift SVN r19101
The XCTest support for Swift is now built as part of XCTest.framework
itself, so the overlay is no longer necessary.
Addresses <rdar://problem/17383462>.
Swift SVN r19016
XCTest needs a way to get the demangled name of a test case class,
so provide one by overriding NSObject.className.
Addresses <rdar://problem/17010812>.
Swift SVN r18606
- rdar://problem/16776273, wherein conversions between nil and .None were permitted
due to an implicit conversion between nil and COpaquePointer.
- rdar://problem/16877526, where we needed to add new equality overloads to handle
conversions between nil and .None given the supression of user conversions.
(Thanks to Ted for the overloads and test.)
Swift SVN r18473
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.
_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.
_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.
_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.
I modified the code in the standard library to the best of my judgement.
rdar://16477198
Swift SVN r18212
Adds an overlay for Xcode's XCTest testing framework.
It implements most of the familiar test assertion macros as equivalent
Swift functions. The assertion macros that aren't currently implemented
are only those that deal specifically with floating-point equality and
Objective-C exceptions. Additionally, the implemented assertions don't
currently handle Objective-C exceptions thrown out of some code called
during an assertion as test failures.
Swift SVN r15917