Skip to content

Commit 869e6af

Browse files
authored
Merge pull request #8 from keroxp/deno-v0.3
fix: bump deno version v0.3
2 parents eef26d0 + 679ac0e commit 869e6af

12 files changed

+51
-54
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
deno.d.ts
22
.idea
33
commands
4+
tsconfig.json

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: python
22

33
install:
4-
- curl -L https://deno.land/x/install/install.py | python - v0.2.6
4+
- curl -fsSL https://deno.land/x/install/install.sh | sh -s -- v0.3.0
55
- export PATH="$HOME/.deno/bin:$PATH"
66

77
services:

Makefile

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
redis:
22
docker run -p 6379:6379 -d -t redis:5
33
test:
4-
deno redis_test.ts --allow-net
5-
deno pubsub_test.ts --allow-net
6-
deno pipeline_test.ts --allow-net
4+
deno --allow-net test.ts

io.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].6/bufio.ts";
2-
import {Buffer} from "deno";
1+
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].11/bufio.ts";
2+
import Buffer = Deno.Buffer;
33
import {ErrorReplyError} from "./errors.ts";
44

55
export type RedisRawReply =

pipeline.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].6/bufio.ts";
1+
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].11/bufio.ts";
22
import {createRequest, readReply, RedisRawReply} from "./io.ts";
33
import {ErrorReplyError} from "./errors.ts";
44
import {create, Redis} from "./redis.ts";

pipeline_test.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {test} from "https://deno.land/x/[email protected]/mod.ts";
2-
import {assertEqual} from "https://deno.land/x/[email protected]/mod.ts";
1+
import {test, assert} from "https://deno.land/x/[email protected]/testing/mod.ts";
32
import {connect} from "./redis.ts";
43

54
const addr = "127.0.0.1:6379";
@@ -16,7 +15,7 @@ test(async function testPipeline() {
1615
pl.del("set2")
1716
]);
1817
const ret = await pl.flush();
19-
assertEqual(ret, [
18+
assert.equal(ret, [
2019
["status", "PONG"],
2120
["status", "PONG"],
2221
["status", "OK"],
@@ -56,7 +55,7 @@ test(async function testTx() {
5655
const rep2 = await tx2.flush();
5756
const rep3 = await tx3.flush();
5857
console.log(rep1);
59-
assertEqual(parseInt(rep1[4][1] as string), parseInt(rep1[0][1] as string) + 3);
60-
assertEqual(parseInt(rep2[4][1] as string), parseInt(rep2[0][1] as string) + 3);
61-
assertEqual(parseInt(rep3[4][1] as string), parseInt(rep3[0][1] as string) + 3);
58+
assert.equal(parseInt(rep1[4][1] as string), parseInt(rep1[0][1] as string) + 3);
59+
assert.equal(parseInt(rep2[4][1] as string), parseInt(rep2[0][1] as string) + 3);
60+
assert.equal(parseInt(rep3[4][1] as string), parseInt(rep3[0][1] as string) + 3);
6261
});

pubsub.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].6/bufio.ts";
1+
import {BufReader, BufWriter} from "https://deno.land/x/[email protected].11/bufio.ts";
22
import {readArrayReply, sendCommand} from "./io.ts";
33

44
export type RedisSubscription = {

pubsub_test.ts

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import {test} from "https://deno.land/x/[email protected]/mod.ts";
2-
import {assertEqual} from "https://deno.land/x/[email protected]/mod.ts"
1+
import {test, assert} from "https://deno.land/x/[email protected]/testing/mod.ts";
32
import {connect} from "./redis.ts";
43
import {RedisPubSubMessage} from "./pubsub.ts";
54

@@ -17,7 +16,7 @@ test(async function testSubscribe() {
1716
//const hoge = await redis.get("hoge");
1817
const unsub = await sub.unsubscribe("subsc");
1918
await sub.close();
20-
assertEqual(sub.isClosed, true);
19+
assert.equal(sub.isClosed, true);
2120
redis.close()
2221
});
2322

@@ -33,12 +32,12 @@ test(async function testSubscribe2() {
3332
await pub.publish("subsc2", "wayway");
3433
await sub.close();
3534
await wait(100);
36-
assertEqual(message, {
35+
assert.equal(message, {
3736
channel: "subsc2",
3837
message: "wayway"
3938
});
4039
const a = await redis.get("aaa");
41-
assertEqual(a, void 0);
40+
assert.equal(a, void 0);
4241
pub.close();
4342
redis.close()
4443
});
@@ -58,12 +57,12 @@ test(async function testPsubscribe() {
5857
await pub.publish("psubs", "heyhey");
5958
await sub.close();
6059
await wait(100);
61-
assertEqual(message1, {
60+
assert.equal(message1, {
6261
pattern: "ps*",
6362
channel: "psub",
6463
message: "wayway"
6564
});
66-
assertEqual(message2, {
65+
assert.equal(message2, {
6766
pattern: "ps*",
6867
channel: "psubs",
6968
message: "heyhey"

redis.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import {Closer, Conn, dial, Reader, Writer} from "deno"
2-
import {BufReader, BufWriter} from "https://deno.land/x/[email protected]/bufio.ts";
1+
type Reader = Deno.Reader;
2+
type Writer = Deno.Writer;
3+
type Closer = Deno.Closer;
4+
import {BufReader, BufWriter} from "https://deno.land/x/[email protected]/bufio.ts";
35
import {ConnectionClosedError} from "./errors.ts";
46
import {psubscribe, RedisSubscription, subscribe} from "./pubsub.ts";
57
import {RedisRawReply, sendCommand} from "./io.ts";
@@ -1375,7 +1377,7 @@ class RedisImpl implements Redis, CommandExecutor {
13751377
}
13761378

13771379
export async function connect(addr: string): Promise<Redis> {
1378-
const conn = await dial("tcp", addr);
1380+
const conn = await Deno.dial("tcp", addr);
13791381
return create(
13801382
conn,
13811383
conn,

redis_test.ts

+20-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import {connect} from "./redis.ts";
2-
import {setFilter, test} from "https://deno.land/x/[email protected]/mod.ts"
3-
import {assertEqual} from "https://deno.land/x/[email protected]/mod.ts"
4-
import {args} from "deno";
5-
6-
if (args.length > 1) {
7-
setFilter(args[1])
8-
}
2+
import {test, assert} from "https://deno.land/x/[email protected]/testing/mod.ts";
93
// can be substituted with env variable
104
const addr = "127.0.0.1:6379";
115

@@ -17,33 +11,33 @@ test(async function beforeAll() {
1711
test(async function testExists() {
1812
const redis = await connect(addr);
1913
const none = await redis.exists("none", "none2");
20-
assertEqual(none, 0);
14+
assert.equal(none, 0);
2115
await redis.set("exists", "aaa");
2216
const exists = await redis.exists("exists", "none");
23-
assertEqual(exists, 1);
17+
assert.equal(exists, 1);
2418
redis.close()
2519
});
2620

2721
test(async function testGetWhenNil() {
2822
const redis = await connect(addr);
2923
const hoge = await redis.get("none");
30-
assertEqual(hoge, void 0);
24+
assert.equal(hoge, void 0);
3125
redis.close();
3226
});
3327
test(async function testSet() {
3428
const redis = await connect(addr);
3529
const s = await redis.set("get", "fuga");
36-
assertEqual(s, "OK");
30+
assert.equal(s, "OK");
3731
const fuga = await redis.get("get");
38-
assertEqual(fuga, "fuga");
32+
assert.equal(fuga, "fuga");
3933
redis.close();
4034
});
4135
test(async function testGetSet() {
4236
const redis = await connect(addr);
4337
await redis.set("getset", "val");
4438
const v = await redis.getset("getset", "lav");
45-
assertEqual(v, "val");
46-
assertEqual(await redis.get("getset"), "lav");
39+
assert.equal(v, "val");
40+
assert.equal(await redis.get("getset"), "lav");
4741
redis.close();
4842
});
4943
test(async function testMget() {
@@ -52,48 +46,48 @@ test(async function testMget() {
5246
await redis.set("mget2", "val2");
5347
await redis.set("mget3", "val3");
5448
const v = await redis.mget("mget1", "mget2", "mget3");
55-
assertEqual(v, ["val1", "val2", "val3"]);
49+
assert.equal(v, ["val1", "val2", "val3"]);
5650
redis.close();
5751
});
5852
test(async function testDel() {
5953
const redis = await connect(addr);
6054
let s = await redis.set("del1", "fuga");
61-
assertEqual(s, "OK");
55+
assert.equal(s, "OK");
6256
s = await redis.set("del2", "fugaaa");
63-
assertEqual(s, "OK");
57+
assert.equal(s, "OK");
6458
const deleted = await redis.del("del1", "del2");
65-
assertEqual(deleted, 2);
59+
assert.equal(deleted, 2);
6660
redis.close();
6761
});
6862

6963
test(async function testIncr() {
7064
const redis = await connect(addr);
7165
const rep = await redis.incr("incr");
72-
assertEqual(rep, 1);
73-
assertEqual(await redis.get("incr"), "1");
66+
assert.equal(rep, 1);
67+
assert.equal(await redis.get("incr"), "1");
7468
redis.close();
7569
});
7670

7771
test(async function testIncrby() {
7872
const redis = await connect(addr);
7973
const rep = await redis.incrby("incrby", 101);
80-
assertEqual(rep, 101);
81-
assertEqual(await redis.get("incrby"), "101");
74+
assert.equal(rep, 101);
75+
assert.equal(await redis.get("incrby"), "101");
8276
redis.close();
8377
});
8478

8579
test(async function testDecr() {
8680
const redis = await connect(addr);
8781
const rep = await redis.decr("decr");
88-
assertEqual(rep, -1);
89-
assertEqual(await redis.get("decr"), "-1");
82+
assert.equal(rep, -1);
83+
assert.equal(await redis.get("decr"), "-1");
9084
redis.close();
9185
});
9286

9387
test(async function testDecrby() {
9488
const redis = await connect(addr);
9589
const rep = await redis.decrby("decryby", 101);
96-
assertEqual(rep, -101);
97-
assertEqual(await redis.get("decryby"), "-101");
90+
assert.equal(rep, -101);
91+
assert.equal(await redis.get("decryby"), "-101");
9892
redis.close();
9993
});

test.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import "./redis_test.ts"
2+
import "./pubsub_test.ts"
3+
import "./pipeline_test.ts"
4+
import {runTests} from "https://deno.land/x/[email protected]/testing/mod.ts";
5+
runTests();

tsconfig.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
22
"compilerOptions": {
33
"target": "es2018",
4-
"baseUrl": ".",
4+
"baseUrl": "/Users/keroxp/Library/Caches",
55
"paths": {
6-
"deno": ["./deno.d.ts"],
76
"https://*": [
8-
"../../.deno/deps/https/*"
7+
"./deno/deps/https/*"
98
],
109
"http://*": [
11-
"../../.deno/deps/http/*"
10+
"./deno/deps/http/*"
1211
]
1312
}
1413
}

0 commit comments

Comments
 (0)