Skip to content

Commit 611cc4e

Browse files
committed
Use swift test --generate-linuxmain to handle index of unit tests
Motivation: A handful of times, unit tests were forgotten to be added to the `allTests` extension, or were incorrectly copy/pasted. Modifications: Remove manual entries of `allTest` and use generated result from `swift test --generate-linuxmain` Result: There should be proper test parity between macOS and Linux.
1 parent 6791ba8 commit 611cc4e

12 files changed

+238
-228
lines changed

Tests/LinuxMain.swift

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1-
//===----------------------------------------------------------------------===//
2-
//
3-
// This source file is part of the RediStack open source project
4-
//
5-
// Copyright (c) 2019 RediStack project authors
6-
// Licensed under Apache License v2.0
7-
//
8-
// See LICENSE.txt for license information
9-
// See CONTRIBUTORS.txt for the list of RediStack project authors
10-
//
11-
// SPDX-License-Identifier: Apache-2.0
12-
//
13-
//===----------------------------------------------------------------------===//
14-
151
import XCTest
162

173
import RediStackTests
184

195
var tests = [XCTestCaseEntry]()
20-
tests += RediStackTests.allTests()
6+
tests += RediStackTests.__allTests()
7+
218
XCTMain(tests)

Tests/RediStackTests/ChannelHandlers/RedisByteDecoderTests.swift

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -300,21 +300,6 @@ extension RedisByteDecoderTests {
300300
}
301301
}
302302

303-
extension RedisByteDecoderTests {
304-
static var allTests = [
305-
("testErrors", testErrors),
306-
("testSimpleStrings", testSimpleStrings),
307-
("testIntegers", testIntegers),
308-
("testBulkStrings", testBulkStrings),
309-
("testArrays", testArrays),
310-
("testAll", testAll),
311-
("test_partial_needsMoreData", test_partial_needsMoreData),
312-
("test_badMessage_throws", test_badMessage_throws),
313-
("test_complete_continues", test_complete_continues),
314-
("test_complete_movesReaderIndex", test_complete_movesReaderIndex),
315-
]
316-
}
317-
318303
extension RedisError: Equatable {
319304
public static func == (lhs: RedisError, rhs: RedisError) -> Bool {
320305
return lhs.message == rhs.message

Tests/RediStackTests/ChannelHandlers/RedisMessageEncoderTests.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,3 @@ final class RedisMessageEncoderTests: XCTestCase {
113113
validation(buffer)
114114
}
115115
}
116-
117-
extension RedisMessageEncoderTests {
118-
static var allTests = [
119-
("testSimpleStrings", testSimpleStrings),
120-
("testBulkStrings", testBulkStrings),
121-
("testIntegers", testIntegers),
122-
("testArrays", testArrays),
123-
("testError", testError),
124-
("testNull", testNull),
125-
]
126-
}

Tests/RediStackTests/Commands/BasicCommandsTests.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,4 @@ final class BasicCommandsTests: RedisIntegrationTestCase {
111111
XCTAssertGreaterThanOrEqual(keys.count, 1)
112112
XCTAssertLessThanOrEqual(keys.count, 7)
113113
}
114-
115-
static var allTests = [
116-
("test_select", test_select),
117-
("test_expire", test_expire),
118-
("test_delete", test_delete),
119-
("test_ping", test_ping),
120-
("test_echo", test_echo),
121-
("test_swapDatabase", test_swapDatabase),
122-
("test_scan", test_scan),
123-
]
124114
}

Tests/RediStackTests/Commands/HashCommandsTests.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -160,22 +160,4 @@ final class HashCommandsTests: RedisIntegrationTestCase {
160160
XCTAssertGreaterThanOrEqual(fields.count, 1)
161161
XCTAssertLessThanOrEqual(fields.count, 7)
162162
}
163-
164-
static var allTests = [
165-
("test_hset", test_hset),
166-
("test_hmset", test_hmset),
167-
("test_hsetnx", test_hsetnx),
168-
("test_hget", test_hget),
169-
("test_hmget", test_hmget),
170-
("test_hgetall", test_hgetall),
171-
("test_hdel", test_hdel),
172-
("test_hexists", test_hexists),
173-
("test_hlen", test_hlen),
174-
("test_hstrlen", test_hstrlen),
175-
("test_hkeys", test_hkeys),
176-
("test_hvals", test_hvals),
177-
("test_hincrby", test_hincrby),
178-
("test_hincrbyfloat", test_hincrbyfloat),
179-
("test_hscan", test_hscan),
180-
]
181163
}

Tests/RediStackTests/Commands/ListCommandsTests.swift

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -236,23 +236,4 @@ final class ListCommandsTests: RedisIntegrationTestCase {
236236
.wait()
237237
XCTAssertEqual(element, 10)
238238
}
239-
240-
static var allTests = [
241-
("test_llen", test_llen),
242-
("test_lindex", test_lindex),
243-
("test_lset", test_lset),
244-
("test_lrem", test_lrem),
245-
("test_lrange", test_lrange),
246-
("test_rpoplpush", test_rpoplpush),
247-
("test_brpoplpush", test_brpoplpush),
248-
("test_linsert", test_linsert),
249-
("test_lpop", test_lpop),
250-
("test_blpop", test_blpop),
251-
("test_lpush", test_lpush),
252-
("test_lpushx", test_lpushx),
253-
("test_rpop", test_rpop),
254-
("test_brpop", test_brpop),
255-
("test_rpush", test_rpush),
256-
("test_rpushx", test_rpushx),
257-
]
258239
}

Tests/RediStackTests/Commands/SetCommandsTests.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -252,22 +252,4 @@ final class SetCommandsTests: RedisIntegrationTestCase {
252252
XCTAssertGreaterThanOrEqual(results.count, 1)
253253
XCTAssertLessThanOrEqual(results.count, 3)
254254
}
255-
256-
static var allTests = [
257-
("test_sadd", test_sadd),
258-
("test_smembers", test_smembers),
259-
("test_sismember", test_sismember),
260-
("test_scard", test_scard),
261-
("test_srem", test_srem),
262-
("test_spop", test_spop),
263-
("test_srandmember", test_srandmember),
264-
("test_sdiff", test_sdiff),
265-
("test_sdiffstore", test_sdiffstore),
266-
("test_sinter", test_sinter),
267-
("test_sinterstore", test_sinterstore),
268-
("test_smove", test_smove),
269-
("test_sunion", test_sunion),
270-
("test_sunionstore", test_sunionstore),
271-
("test_sscan", test_sscan),
272-
]
273255
}

Tests/RediStackTests/Commands/SortedSetCommandsTests.swift

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -381,32 +381,4 @@ final class SortedSetCommandsTests: RedisIntegrationTestCase {
381381
count = try connection.zremrangebyscore(within: ("-inf", "+inf"), from: key).wait()
382382
XCTAssertEqual(count, 5)
383383
}
384-
385-
static var allTests = [
386-
("test_zadd", test_zadd),
387-
("test_zcard", test_zcard),
388-
("test_zscore", test_zscore),
389-
("test_zscan", test_zscan),
390-
("test_zrank", test_zrank),
391-
("test_zrevrank", test_zrevrank),
392-
("test_zcount", test_zcount),
393-
("test_zlexcount", test_zlexcount),
394-
("test_zpopmin", test_zpopmin),
395-
("test_bzpopmin", test_bzpopmin),
396-
("test_zpopmax", test_zpopmax),
397-
("test_bzpopmax", test_bzpopmax),
398-
("test_zincrby", test_zincrby),
399-
("test_zunionstore", test_zunionstore),
400-
("test_zinterstore", test_zinterstore),
401-
("test_zrange", test_zrange),
402-
("test_zrevrange", test_zrevrange),
403-
("test_zrangebyscore", test_zrangebyscore),
404-
("test_zrevrangebyscore", test_zrevrangebyscore),
405-
("test_zrangebylex", test_zrangebylex),
406-
("test_zrevrangebylex", test_zrevrangebylex),
407-
("test_zrem", test_zrem),
408-
("test_zremrangebylex", test_zremrangebylex),
409-
("test_zremrangebyrank", test_zremrangebyrank),
410-
("test_zremrangebyscore", test_zremrangebyscore),
411-
]
412384
}

Tests/RediStackTests/Commands/StringCommandsTests.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,4 @@ final class StringCommandsTests: RedisIntegrationTestCase {
128128
result = try connection.decrement(#function, by: 0).wait()
129129
XCTAssertEqual(result, 7)
130130
}
131-
132-
static var allTests = [
133-
("test_get", test_get),
134-
("test_mget", test_mget),
135-
("test_set", test_set),
136-
("test_append", test_append),
137-
("test_mset", test_mset),
138-
("test_msetnx", test_msetnx),
139-
("test_increment", test_increment),
140-
("test_incrementBy", test_incrementBy),
141-
("test_incrementByFloat", test_incrementByFloat),
142-
("test_decrement", test_decrement),
143-
("test_decrementBy", test_decrementBy),
144-
]
145131
}

Tests/RediStackTests/RESPTranslatorTests.swift

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -478,51 +478,3 @@ extension RESPTranslatorTests {
478478
return result
479479
}
480480
}
481-
482-
// MARK: All Tests
483-
484-
extension RESPTranslatorTests {
485-
static var allTests = [
486-
("testWriting_simpleStrings", testWriting_simpleStrings),
487-
("testWriting_bulkStrings", testWriting_bulkStrings),
488-
("testWriting_integers", testWriting_integers),
489-
("testWriting_arrays", testWriting_arrays),
490-
("testWriting_errors", testWriting_errors),
491-
("testWriting_null", testWriting_null),
492-
("testWriting_foundationData", testWriting_foundationData),
493-
494-
("testParsing_invalidSymbols", testParsing_invalidSymbols),
495-
("testParsing_simpleString", testParsing_simpleString),
496-
("testParsing_simpleString_chunked", testParsing_simpleString_chunked),
497-
("testParsing_integer", testParsing_integer),
498-
("testParsing_integer_chunked", testParsing_integer_chunked),
499-
("testParsing_bulkStrings", testParsing_bulkStrings),
500-
("testParsing_bulkStrings_chunked", testParsing_bulkStrings_chunked),
501-
("testParsing_arrays", testParsing_arrays),
502-
("testParsing_arrays_chunked", testParsing_arrays_chunked),
503-
("testParsing_error", testParsing_error),
504-
505-
("testParsing_simpleString_missingNewline", testParsing_simpleString_missingNewline),
506-
("testParsing_simpleString_withNoContent", testParsing_simpleString_withNoContent),
507-
("testParsing_simpleString_withContent", testParsing_simpleString_withContent),
508-
("testParsing_simpleString_handlesRecursion", testParsing_simpleString_handlesRecursion),
509-
510-
("testParsing_integer_withAllBytes", testParsing_integer_withAllBytes),
511-
("testParsing_integer_missingBytes", testParsing_integer_missingBytes),
512-
("testParsing_integer_recursively", testParsing_integer_recursively),
513-
514-
("testParsing_bulkString_missingEndings", testParsing_bulkString_missingEndings),
515-
("testParsing_bulkString_withNoSize", testParsing_bulkString_withNoSize),
516-
("testParsing_bulkString_withContent", testParsing_bulkString_withContent),
517-
("testParsing_bulkString_null", testParsing_bulkString_null),
518-
("testParsing_bulkString_rawBytes", testParsing_bulkString_rawBytes),
519-
("testParsing_bulkString_recursively", testParsing_bulkString_recursively),
520-
521-
("testParsing_array_whenNull", testParsing_array_whenNull),
522-
("testParsing_array_whenEmpty", testParsing_array_whenEmpty),
523-
("testParsing_array_withMixedTypes", testParsing_array_withMixedTypes),
524-
("testParsing_array_withNullElements", testParsing_array_withNullElements),
525-
("testParsing_array_nested", testParsing_array_nested),
526-
("testParsing_array_recursively", testParsing_array_recursively),
527-
]
528-
}

0 commit comments

Comments
 (0)