mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[gardening] Remove accidental trailing whitespace (" " and "\t")
This commit is contained in:
@@ -93,11 +93,11 @@ POSIXTests.test("ioctl(CInt, UInt, CInt): fail") {
|
||||
let fd = open(fn, 0)
|
||||
expectEqual(-1, fd)
|
||||
expectEqual(ENOENT, errno)
|
||||
|
||||
|
||||
// A simple check to verify that ioctl is available
|
||||
let _ = ioctl(fd, 0, 0)
|
||||
expectEqual(EBADF, errno)
|
||||
}
|
||||
}
|
||||
|
||||
#if os(Linux)
|
||||
// Successful creation of a socket and listing interfaces
|
||||
@@ -122,7 +122,7 @@ POSIXTests.test("fcntl(CInt, CInt): fail") {
|
||||
let fd = open(fn, 0)
|
||||
expectEqual(-1, fd)
|
||||
expectEqual(ENOENT, errno)
|
||||
|
||||
|
||||
let _ = fcntl(fd, F_GETFL)
|
||||
expectEqual(EBADF, errno)
|
||||
}
|
||||
@@ -132,28 +132,28 @@ POSIXTests.test("fcntl(CInt, CInt): F_GETFL/F_SETFL success with file") {
|
||||
// Create and open file.
|
||||
let fd = open(fn, O_CREAT, 0o666)
|
||||
expectGT(Int(fd), 0)
|
||||
|
||||
|
||||
var flags = fcntl(fd, F_GETFL)
|
||||
expectGE(Int(flags), 0)
|
||||
|
||||
|
||||
// Change to APPEND mode...
|
||||
var rc = fcntl(fd, F_SETFL, O_APPEND)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
flags = fcntl(fd, F_GETFL)
|
||||
expectEqual(flags | O_APPEND, flags)
|
||||
|
||||
|
||||
// Change back...
|
||||
rc = fcntl(fd, F_SETFL, 0)
|
||||
expectEqual(0, rc)
|
||||
|
||||
flags = fcntl(fd, F_GETFL)
|
||||
expectGE(Int(flags), 0)
|
||||
|
||||
|
||||
// Clean up...
|
||||
rc = close(fd)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
rc = unlink(fn)
|
||||
expectEqual(0, rc)
|
||||
}
|
||||
@@ -162,24 +162,24 @@ POSIXTests.test("fcntl(CInt, CInt, CInt): block and unblocking sockets success")
|
||||
// Create socket, note: socket created by default in blocking mode...
|
||||
let sock = socket(PF_INET, 1, 0)
|
||||
expectGT(Int(sock), 0)
|
||||
|
||||
|
||||
var flags = fcntl(sock, F_GETFL)
|
||||
expectGE(Int(flags), 0)
|
||||
|
||||
|
||||
// Change mode of socket to non-blocking...
|
||||
var rc = fcntl(sock, F_SETFL, flags | O_NONBLOCK)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
flags = fcntl(sock, F_GETFL)
|
||||
expectEqual((flags | O_NONBLOCK), flags)
|
||||
|
||||
|
||||
// Change back to blocking...
|
||||
rc = fcntl(sock, F_SETFL, flags & ~O_NONBLOCK)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
flags = fcntl(sock, F_GETFL)
|
||||
expectGE(Int(flags), 0)
|
||||
|
||||
|
||||
// Clean up...
|
||||
rc = close(sock)
|
||||
expectEqual(0, rc)
|
||||
@@ -189,35 +189,35 @@ POSIXTests.test("fcntl(CInt, CInt, UnsafeMutableRawPointer): locking and unlocki
|
||||
// Create the file and add data to it...
|
||||
var fd = open(fn, O_CREAT | O_WRONLY, 0o666)
|
||||
expectGT(Int(fd), 0)
|
||||
|
||||
|
||||
let data = "Testing 1 2 3"
|
||||
let bytesWritten = write(fd, data, data.utf8.count)
|
||||
expectEqual(data.utf8.count, bytesWritten)
|
||||
|
||||
|
||||
var rc = close(fd)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
// Re-open the file...
|
||||
fd = open(fn, 0)
|
||||
expectGT(Int(fd), 0)
|
||||
|
||||
|
||||
// Lock for reading...
|
||||
var flck = flock()
|
||||
flck.l_type = Int16(F_RDLCK)
|
||||
flck.l_len = off_t(data.utf8.count)
|
||||
rc = fcntl(fd, F_SETLK, &flck)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
// Unlock for reading...
|
||||
flck = flock()
|
||||
flck.l_type = Int16(F_UNLCK)
|
||||
rc = fcntl(fd, F_SETLK, &flck)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
// Clean up...
|
||||
rc = close(fd)
|
||||
expectEqual(0, rc)
|
||||
|
||||
|
||||
rc = unlink(fn)
|
||||
expectEqual(0, rc)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user