Skip to content

Commit

Permalink
Merge branch 'fix-arrays' of git://github.com/eknoes/redis-dart
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1u committed Aug 9, 2019
2 parents 43fc6db + d83fd2d commit 5bf8243
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/redisserialise.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class RedisSerialise {
consumer(_star);
consumer(_IntToRaw(len));
consumer(_linesep);
object.forEach((v)=>SerialiseConsumable(v,consumer));
object.forEach((v)=> SerialiseConsumable(v is int ? v.toString() : v,consumer));
}
else if(object is int){
consumer(_semicol);
Expand Down
4 changes: 3 additions & 1 deletion test/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
library testredis;
import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'dart:io';

import '../lib/redis.dart';

part 'testcas.dart';
Expand All @@ -21,6 +21,7 @@ part 'testpubsub.dart';
part 'testlua.dart';
part 'testunicode.dart';
part 'testerror.dart';
part 'testconversion.dart';


Future testing_performance(Function fun,String name, int rep){
Expand Down Expand Up @@ -55,6 +56,7 @@ main(){
q.add(testing_helper(testincrcasmultiple(),"CAS"));
q.add(testing_helper(testluanative(),"eval"));
q.add(testing_helper(testError(),"throw RedisError instead of return"));
q.add(testing_helper(testConversion(),"Convert ints to strings when in Array"));

Future.wait(q)
.then((_){
Expand Down
18 changes: 18 additions & 0 deletions test/testconversion.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
part of testredis;

Future testConversion() {

RedisConnection conn = new RedisConnection();
return conn.connect('localhost',6379).then((Command command) {
command.send_object(["SADD", "test_list", 1]).then((val) {
if(val is RedisError) {
throw "Expected redis-dart to convert integers to bulk strings when contained in array.";
}
return true;
})
.catchError((error) {
throw "Expected redis-dart to convert integers to bulk strings when contained in array.";
});
});

}

0 comments on commit 5bf8243

Please sign in to comment.