Files
swift-mirror/test/stdlib/StringDescribing.swift
Joe Groff a7a3b17597 Replace nominal type descriptors with a hierarchy of context descriptors.
This new format more efficiently represents existing information, while
more accurately encoding important information about nested generic
contexts with same-type and layout constraints that need to be evaluated
at runtime. It's also designed with an eye to forward- and
backward-compatible expansion for ABI stability with future Swift
versions.
2018-01-29 16:19:25 -08:00

26 lines
723 B
Swift

// RUN: %target-run-simple-swift
// REQUIRES: executable_test
import StdlibUnittest
private class Foo {}
class Bar {}
var StringDescribingTestSuite = TestSuite("StringDescribing")
StringDescribingTestSuite.test("String(describing:) shouldn't include extra stuff if the class is private") {
expectEqual(String(describing: Foo.self), "Foo")
expectEqual(String(describing: Bar.self), "Bar")
}
StringDescribingTestSuite.test("String(reflecting:) should include extra stuff if the class is private") {
expectEqual(String(reflecting: Bar.self), "main.Bar")
let privateName = String(reflecting: Foo.self)
expectEqual(privateName.prefix(6), "main.(")
expectEqual(privateName.suffix(5), ").Foo")
}
runAllTests()