Skip to content

Commit 5caa605

Browse files
authored
Merge pull request #98 from JuliaDatabases/tan/misc
fix: typo in error handling
2 parents c175a76 + 0eff6b9 commit 5caa605

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ jobs:
4646
- uses: codecov/codecov-action@v2
4747
with:
4848
files: lcov.info
49+
fail_ci_if_error: false

src/client.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function convert_response(::Type{Union{T, Nothing}}, response) where {T <: Abstr
9191
end
9292

9393
function convert_response(::Type{Union{Array{T, 1}, Nothing}}, response) where {T <: AbstractString}
94-
if response == nothing
94+
if response === nothing
9595
nothing
9696
else
9797
convert_response(Array{T, 1}, response)
@@ -100,7 +100,7 @@ end
100100

101101
# redundant
102102
function convert_response(::Type{Array{Union{T, Nothing}, 1}}, response) where {T<:Number}
103-
if response == nothing
103+
if response === nothing
104104
Array{Union{T, Nothing}, 1}()
105105
else
106106
r = Array{Union{T, Nothing}, 1}()
@@ -112,7 +112,7 @@ function convert_response(::Type{Array{Union{T, Nothing}, 1}}, response) where {
112112
end
113113

114114
function convert_response(::Type{Array{Union{T, Nothing}, 1}}, response) where {T <: AbstractString}
115-
if response == nothing
115+
if response === nothing
116116
Array{Union{T, Nothing}, 1}()
117117
else
118118
r = Array{Union{T, Nothing}, 1}()

src/parser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function parse_bulk_string(s::TCPSocket, slen::Int)
2323
b = read(s, slen+2) # add crlf
2424
if length(b) != slen + 2
2525
throw(ProtocolException(
26-
"Bulk string read error: expected $len bytes; received $(length(b))"
26+
"Bulk string read error: expected $slen bytes; received $(length(b))"
2727
))
2828
else
2929
return resize!(b, slen)

test/redis_tests.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const REDIS_EXPIRED_KEY = -2
2626
@test del(conn, testkey, "notakey", "notakey2") == 1 # only 1 of 3 key exists
2727

2828
# 'NIL'
29-
@test get(conn, "notakey") == nothing
29+
@test get(conn, "notakey") === nothing
3030

3131
set(conn, testkey, s1)
3232
set(conn, testkey2, s2)
@@ -143,12 +143,12 @@ end
143143
@test lpush(conn, testkey, s1, s2, "a", "a", s3, s4) == 6
144144
@test lpop(conn, testkey) == s4
145145
@test rpop(conn, testkey) == s1
146-
@test lpop(conn, "non_existent_list") == nothing
147-
@test rpop(conn, "non_existent_list") == nothing
146+
@test lpop(conn, "non_existent_list") === nothing
147+
@test rpop(conn, "non_existent_list") === nothing
148148
@test llen(conn, testkey) == 4
149-
@test lindex(conn, "non_existent_list", 1) == nothing
149+
@test lindex(conn, "non_existent_list", 1) === nothing
150150
@test lindex(conn, testkey, 0) == s3
151-
@test lindex(conn, testkey, 10) == nothing
151+
@test lindex(conn, testkey, 10) === nothing
152152
@test lrem(conn, testkey, 0, "a") == 2
153153
@test lset(conn, testkey, 0, s5) == "OK"
154154
@test lindex(conn, testkey, 0) == s5
@@ -167,7 +167,7 @@ end
167167
for i in 1:3
168168
@test rpoplpush(conn, testkey, testkey2) == listvals[4-i] # rpop
169169
end
170-
@test rpoplpush(conn, testkey, testkey2) == nothing
170+
@test rpoplpush(conn, testkey, testkey2) === nothing
171171
@test llen(conn, testkey) == 0
172172
@test llen(conn, testkey2) == 3
173173
@test lrange(conn, testkey2, 0, -1) == listvals
@@ -191,11 +191,11 @@ end
191191
@test hget(conn, testhash, 1) == "2"
192192
@test hgetall(conn, testhash) == Dict("1" => "2", "3" => "4", "5" => "6")
193193

194-
@test hget(conn, testhash, "non_existent_field") == nothing
194+
@test hget(conn, testhash, "non_existent_field") === nothing
195195
@test hmget(conn, testhash, 1, 3) == ["2", "4"]
196196
a = hmget(conn, testhash, "non_existent_field1", "non_existent_field2")
197-
@test a[1] == nothing
198-
@test a[2] == nothing
197+
@test a[1] === nothing
198+
@test a[2] === nothing
199199

200200
@test Set(hvals(conn, testhash)) == Set(["2", "4", "6"]) # use Set for comp as hash ordering is random
201201
@test Set(hkeys(conn, testhash)) == Set(["1", "3", "5"])
@@ -239,13 +239,13 @@ end
239239
@test sinterstore(conn, testkey3, testkey, testkey2) == 1
240240
# only the following method returns 'nil' if the Set does not exist
241241
@test srandmember(conn, testkey3) in Set([s1, s2, s3])
242-
@test srandmember(conn, "empty_set") == nothing
242+
@test srandmember(conn, "empty_set") === nothing
243243
# this method returns an emtpty Set if the the Set is empty
244244
@test issubset(srandmember(conn, testkey2, 2), Set([s1, s2, s3]))
245245
@test srandmember(conn, "non_existent_set", 10) == Set{AbstractString}()
246246
@test sdiff(conn, testkey, testkey2) == Set([s1])
247247
@test spop(conn, testkey) in Set([s1, s2, s3])
248-
@test spop(conn, "empty_set") == nothing
248+
@test spop(conn, "empty_set") === nothing
249249
del(conn, testkey, testkey2, testkey3)
250250
end
251251

@@ -287,7 +287,7 @@ end
287287
@test zrank(conn, testkey, "d") == 3 # redis arrays 0-base
288288

289289
# 'NIL'
290-
@test zrank(conn, testkey, "z") == nothing
290+
@test zrank(conn, testkey, "z") === nothing
291291
del(conn, testkey)
292292

293293
zadd(conn, testkey, zip(1:length(vals), vals)...)
@@ -301,9 +301,9 @@ end
301301
@test zrevrangebyscore(conn, testkey, 7, 5) == OrderedSet(["g", "f", "e"])
302302
@test zrevrangebyscore(conn, testkey, "(6", "(5") == OrderedSet{AbstractString}()
303303
@test zrevrank(conn, testkey, "e") == 5
304-
@test zrevrank(conn, "ordered_set", "non_existent_member") == nothing
304+
@test zrevrank(conn, "ordered_set", "non_existent_member") === nothing
305305
@test zscore(conn, testkey, "e") == "5"
306-
@test zscore(conn, "ordered_set", "non_existent_member") == nothing
306+
@test zscore(conn, "ordered_set", "non_existent_member") === nothing
307307
del(conn, testkey)
308308

309309
vals2 = ["a", "b", "c", "d"]

0 commit comments

Comments
 (0)