Add a CONTRIBUTING.md, fix indent

... beautz is in the eye of the beholder.
This commit is contained in:
Helge Hess 2018-06-09 10:40:03 +02:00
parent 1a55bd2031
commit c3720e219d
No known key found for this signature in database
GPG Key ID: B5808815DFD45B99
5 changed files with 45 additions and 34 deletions

5
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,5 @@
By submitting a pull request, you represent that you have the right to license
your contribution to the community, and agree by submitting the patch
that your contributions are licensed under the Apache 2.0 license (see
`LICENSE.txt`).

View File

@ -2,11 +2,12 @@ import XCTest
@testable import NIORedis @testable import NIORedis
final class RESPValueTests: XCTestCase { final class RESPValueTests: XCTestCase {
func testDescription() throws {
XCTAssert(String(describing: RESPValue(1)) == "1") func testDescription() throws {
} XCTAssert(String(describing: RESPValue(1)) == "1")
}
static var allTests = [ static var allTests = [
("testDescription", testDescription) ("testDescription", testDescription)
] ]
} }

View File

@ -2,8 +2,8 @@ import XCTest
#if !os(macOS) #if !os(macOS)
public func allTests() -> [XCTestCaseEntry] { public func allTests() -> [XCTestCaseEntry] {
return [ return [
testCase(RESPValueTests.allTests), testCase(RESPValueTests.allTests),
] ]
} }
#endif #endif

View File

@ -1,32 +1,37 @@
import XCTest import XCTest
@testable import Redis
import NIO import NIO
@testable import Redis
final class RedisClientTests: XCTestCase { final class RedisClientTests: XCTestCase {
func testCreateClientWithDefaultArguments() throws {
let redisClient = Redis.createClient() func testCreateClientWithDefaultArguments() throws {
let redisClient = Redis.createClient()
XCTAssert(redisClient.options.hostname! == "127.0.0.1") XCTAssert(redisClient.options.hostname! == "127.0.0.1")
XCTAssert(redisClient.options.port == 6379) XCTAssert(redisClient.options.port == 6379)
XCTAssert(redisClient.options.password == nil) XCTAssert(redisClient.options.password == nil)
XCTAssert(redisClient.options.database == nil) XCTAssert(redisClient.options.database == nil)
} }
func testCreateClientWithSpecifiedArguments() throws { func testCreateClientWithSpecifiedArguments() throws {
let eventLoop = MultiThreadedEventLoopGroup(numberOfThreads: 1).next() let eventLoop = MultiThreadedEventLoopGroup(numberOfThreads: 1).next()
let redisClient = Redis.createClient(port: 6380, host: "localhost", password: "password", db: 1, eventLoopGroup: eventLoop) let redisClient = Redis.createClient(port: 6380, host: "localhost",
password: "password", db: 1,
eventLoopGroup: eventLoop)
XCTAssert(redisClient.options.hostname! == "localhost") XCTAssert(redisClient.options.hostname! == "localhost")
XCTAssert(redisClient.options.port == 6380) XCTAssert(redisClient.options.port == 6380)
XCTAssert(redisClient.options.password == "password") XCTAssert(redisClient.options.password == "password")
XCTAssert(redisClient.options.database == 1) XCTAssert(redisClient.options.database == 1)
XCTAssert(redisClient.options.eventLoopGroup === eventLoop) XCTAssert(redisClient.options.eventLoopGroup === eventLoop)
XCTAssert(redisClient.eventLoop === eventLoop) XCTAssert(redisClient.eventLoop === eventLoop)
} }
static var allTests = [ static var allTests = [
("testCreateClientWithDefaultArguments", testCreateClientWithDefaultArguments), ( "testCreateClientWithDefaultArguments",
("testCreateClientWithSpecifiedArguments", testCreateClientWithSpecifiedArguments), testCreateClientWithDefaultArguments. ),
] ( "testCreateClientWithSpecifiedArguments",
testCreateClientWithSpecifiedArguments ),
]
} }

View File

@ -2,8 +2,8 @@ import XCTest
#if !os(macOS) #if !os(macOS)
public func allTests() -> [XCTestCaseEntry] { public func allTests() -> [XCTestCaseEntry] {
return [ return [
testCase(RedisClientTests.allTests), testCase(RedisClientTests.allTests),
] ]
} }
#endif #endif