Files
swift-mirror/validation-test/stdlib/Glibc.swift
Mark Lacey 8b55a0f61b SE-0054: Rework diagnostics for IUOs and revise Swift 3 /4 semantics.
For Swift 3 / 4:

Deprecate the spelling "ImplicitlyUnwrappedOptional", emitting a warning
and suggesting "!" in places where they are allowed according to
SE-0054.

In places where SE-0054 disallowed IUOs but we continued to accept them
in previous compilers, emit a warning suggesting "Optional" or "?"  as
an alternative depending on context and treat the IUO as an Optional,
noting this in the diagnostic.

For Swift 5:

Treat "ImplicitlyUnwrappedOptional" as an error, suggesting
"!" in places where they are allowed by SE-0054.

In places where SE-0054 disallowed IUOs, emit an error suggestion
"Optional" or "?" as an alternative depending on context.
2017-11-18 11:41:53 +09:00

39 lines
751 B
Swift

// RUN: %target-run-simple-swift
// REQUIRES: executable_test
//
// UNSUPPORTED: OS=macosx
// UNSUPPORTED: OS=ios
// UNSUPPORTED: OS=tvos
// UNSUPPORTED: OS=watchos
// UNSUPPORTED: OS=linux-androideabi
// REQUIRES: OS=linux-gnu
import Swift
import StdlibUnittest
import Glibc
var GlibcTestSuite = TestSuite("Glibc")
GlibcTestSuite.test("errno") {
errno = 0
expectEqual(0, errno)
close(-1)
expectEqual(EBADF, errno)
}
GlibcTestSuite.test("sendfile") {
// Check that `sendfile` is available. Don't actually call it, because doing that is non-trivial.
_ = sendfile
}
var GlibcIoctlConstants = TestSuite("GlibcIoctlConstants")
GlibcIoctlConstants.test("tty ioctl constants availability") {
let aConstant = TIOCSTI
}
runAllTests()