Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Removed old tests

  • Loading branch information...
commit 6b91eadd89a3e18bc5dffa8085a28364c348ffb3 1 parent 00e55c9
TJ Holowaychuk authored January 05, 2011
6  .gitmodules
... ...
@@ -1,6 +0,0 @@
1  
-[submodule "support/expresso"]
2  
-	path = support/expresso
3  
-	url = git://github.com/visionmedia/expresso.git
4  
-[submodule "support/should"]
5  
-	path = support/should
6  
-	url = git://github.com/visionmedia/should.js.git
13  lib/commands/string.js
@@ -134,11 +134,20 @@ exports.append = function(client, key, str){
134 134
 };
135 135
 
136 136
 /**
137  
- * SETRANGE <key> <offset> <val>
  137
+ * SETRANGE <key> <offset> <str>
138 138
  */
139 139
 
140  
-exports.setrange = function(client, key, offset, val){
  140
+exports.setrange = function(client, key, offset, str){
  141
+  var key = utils.string(key)
  142
+    , val = this.data[key]
  143
+    , offset = +utils.string(offset);
141 144
   
  145
+  if (null == val) {
  146
+    // TODO: finish
  147
+  } else {
  148
+    str.copy(val, offset);
  149
+    client.int(val.length);
  150
+  }
142 151
 };
143 152
 
144 153
 /**
1  support/expresso
... ...
@@ -1 +0,0 @@
1  
-Subproject commit a632633104bb8da4eff0f3d0c15ca68997d5df84
1  support/should
... ...
@@ -1 +0,0 @@
1  
-Subproject commit c05fac17d9894f1daeefded4db6609f962424831
127  test/redis.test.js
... ...
@@ -1,127 +0,0 @@
1  
-
2  
-/**
3  
- * Module dependencies.
4  
- */
5  
-
6  
-var nedis = require('nedis')
7  
-  , should = require('should')
8  
-  , net = require('net');
9  
-
10  
-var server = nedis.createServer().listen('/tmp/nedis')
11  
-  , client;
12  
-
13  
-module.exports = {
14  
-  before: function(done){
15  
-    server.on('listening', function(){
16  
-      client = net.createConnection('/tmp/nedis');
17  
-      client.on('connect', done);
18  
-      client.once = function(event, fn){
19  
-        client.on(event, function callback(){
20  
-          client.removeListener(event, callback);
21  
-          fn.apply(this, arguments);
22  
-        });
23  
-      };
24  
-    });
25  
-  },
26  
-  
27  
-  'test .version': function(){
28  
-    nedis.version.should.match(/^\d+\.\d+\.\d+$/);
29  
-  },
30  
-  
31  
-  'test Server inheritance': function(){
32  
-    var server = nedis.createServer();
33  
-    server.should.be.an.instanceof(net.Server);
34  
-  },
35  
-  
36  
-  'test lowercase command': function(done){
37  
-    client.write('*2\r\n$3\r\nget\r\n$3\r\nfoo\r\n');
38  
-    client.once('data', function(chunk){
39  
-      chunk.toString().should.equal('$-1\r\n');
40  
-      done();
41  
-    });
42  
-  },
43  
-  
44  
-  'test missing bulk length LF': function(done){
45  
-    client.write('*3\r\n$3\rGET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
46  
-    client.once('data', function(chunk){
47  
-      chunk.toString().should.equal("-ERR missing line feed for bulk length\r\n");
48  
-      done();
49  
-    });
50  
-  },
51  
-
52  
-  'test invalid multi-bulk number': function(done){
53  
-    client.write('*asdf\r\n$3\rGET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
54  
-    client.once('data', function(chunk){
55  
-      chunk.toString().should.equal("-ERR Protocol error: number expected after *\r\n");
56  
-      done();
57  
-    });
58  
-  },
59  
-  
60  
-  'test invalid bulk number': function(done){
61  
-    client.write('*2\r\n$ohnoes\r\nGET\r\n$3\r\nfoo\r\n');
62  
-    client.once('data', function(chunk){
63  
-      chunk.toString().should.equal("-ERR Protocol error: number expected after $\r\n");
64  
-      done();
65  
-    });
66  
-  },
67  
-  
68  
-  'test invalid command': function(done){
69  
-    client.write('*2\r\n$7\r\nINVALID\r\n$3\r\nfoo\r\n');
70  
-    client.once('data', function(chunk){
71  
-      chunk.toString().should.equal("-ERR unknown command 'invalid'\r\n");
72  
-      done();
73  
-    });
74  
-  },
75  
-  
76  
-  'test GET <key>': function(done){
77  
-    client.write('*2\r\n$3\r\nGET\r\n$3\r\nfoo\r\n');
78  
-    client.once('data', function(chunk){
79  
-      chunk.toString().should.equal('$-1\r\n');
80  
-      done();
81  
-    });
82  
-  },
83  
-
84  
-  'test SET <key> <val>': function(done){
85  
-    client.write('*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
86  
-    client.once('data', function(chunk){
87  
-      chunk.toString().should.equal('+OK\r\n');
88  
-      done();
89  
-    });
90  
-  },
91  
-  
92  
-  'test SET multiple calls': function(done){
93  
-    client.write('*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
94  
-    client.write('*3\r\n$3\r\nSET\r\n$3\r\nfoo\r\n$3\r\nbaz\r\n');
95  
-    client.write('*3\r\n$3\r\nSET\r\n$3\r\nbar\r\n$3\r\nraz\r\n');
96  
-    client.once('data', function(chunk){
97  
-      chunk.toString().should.equal('+OK\r\n+OK\r\n+OK\r\n');
98  
-      client.write('*2\r\n$3\r\nGET\r\n$3\r\nfoo\r\n');
99  
-      client.write('*2\r\n$3\r\nGET\r\n$3\r\nbar\r\n');
100  
-      client.once('data', function(chunk){
101  
-        chunk.toString().should.equal('$3\r\nbaz\r\n$3\r\nraz\r\n');
102  
-        done();
103  
-      })
104  
-    });
105  
-  },
106  
-  
107  
-  'test KEYS *': function(done){
108  
-    client.write('*2\r\n$4\r\nKEYS\r\n$1\r\n*\r\n');
109  
-    client.once('data', function(chunk){
110  
-      chunk.toString().should.equal('*2\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
111  
-      done();
112  
-    });
113  
-  },
114  
-  
115  
-  'test GET invalid args': function(done){
116  
-    client.write('*3\r\n$3\r\nGET\r\n$3\r\nfoo\r\n$3\r\nbar\r\n');
117  
-    client.once('data', function(chunk){
118  
-      chunk.toString().should.equal("-ERR wrong number of arguments for 'get' command\r\n");
119  
-      done();
120  
-    });
121  
-  },
122  
-  
123  
-  after: function(){
124  
-    client.destroy();
125  
-    server.close();
126  
-  }
127  
-};

0 notes on commit 6b91ead

Please sign in to comment.
Something went wrong with that request. Please try again.