rcstorable 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ext/rcstorable.c +3 -2
- data/spec/rcstorable_spec.rb +14 -0
- data/spec/store.pl +6 -9
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/ext/rcstorable.c
CHANGED
@@ -122,6 +122,9 @@ read_object()
|
|
122
122
|
case PT_STRING_ALT:
|
123
123
|
object = read_string(false);
|
124
124
|
break;
|
125
|
+
case PT_HASH_KEY:
|
126
|
+
object = read_string(true);
|
127
|
+
break;
|
125
128
|
case PT_VECTOR:
|
126
129
|
object = read_object(); // This is a marker we can just ignore...
|
127
130
|
break;
|
@@ -185,12 +188,10 @@ read_string(bool extended_size)
|
|
185
188
|
uchar *tp = serialized;
|
186
189
|
|
187
190
|
if (size == 319) { // apparently Storable uses \000\000\001\077 to mean "read until n<7"
|
188
|
-
printf("319\n");
|
189
191
|
while (*tp++ >= 7) {
|
190
192
|
check_pointer(tp);
|
191
193
|
actual_size++;
|
192
194
|
}
|
193
|
-
printf("319:%d\n",actual_size);
|
194
195
|
size = actual_size;
|
195
196
|
}
|
196
197
|
|
data/spec/rcstorable_spec.rb
CHANGED
@@ -27,5 +27,19 @@ describe RCStorable do
|
|
27
27
|
RCStorable.thaw(store).should == expected
|
28
28
|
end
|
29
29
|
|
30
|
+
it "arrays should work" do
|
31
|
+
store = "\005\a\003\000\000\000\001\004\002\000\000\000\003\n\004asdf\n\004zxcv\n\004qwer\000\000\000\001b"
|
32
|
+
|
33
|
+
expected = {"b" => ["asdf", "zxcv", "qwer"]}
|
34
|
+
|
35
|
+
RCStorable.thaw(store).should == expected
|
36
|
+
end
|
30
37
|
|
38
|
+
it "empty hash" do
|
39
|
+
store = "\005\a\003\000\000\000\001\004\003\000\000\000\000\000\000\000\001a"
|
40
|
+
|
41
|
+
expected = {"a" => {}}
|
42
|
+
RCStorable.thaw(store).should == expected
|
43
|
+
end
|
44
|
+
|
31
45
|
end
|
data/spec/store.pl
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
use strict;
|
3
2
|
use warnings;
|
4
3
|
|
@@ -6,16 +5,14 @@ use Storable;
|
|
6
5
|
use Data::Dumper;
|
7
6
|
|
8
7
|
my %blah = (
|
9
|
-
"a" => "
|
10
|
-
"b" => "35",
|
11
|
-
"c" => {
|
12
|
-
"p" => "blah",
|
13
|
-
"q" => "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
|
14
|
-
},
|
15
|
-
"longer_key_name" => "29",
|
8
|
+
"a" => "asdfjasd;flkasdjf;alsdfkjasd;lfkjasd;flkjasdf;lkajsdf;lkasdjf;alskdjfa;lskfjas;ldfkjasd;lfkjasdf;lkjasdf;lkasdjf;laksdfjas;ldfkjasd;lfkjasd;lfkjasdf;lkajsdf;lkasdjf;laksdfja;sldfkjasd;lfkjasdf;lkajdfasdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsafasdfasdfasdfasdfjasd;flkasdjf;alsdfkjasd;lfkjasd;flkjasdf;lkajsdf;lkasdjf;alskdjfa;lskfjas;ldfkjasd;lfkjasdf;lkjasdf;lkasdjf;laksdfjas;ldfkjasd;lfkjasd;lfkjasdf;lkajsdf;lkasdjf;laksdfja;sldfkjasd;lfkjasdf;lkajdfasdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsafasdfasdfasdfasdfjasd;flkasdjf;alsdfkjasd;lfkjasd;flkjasdf;lkajsdf;lkasdjf;alskdjfa;lskfjas;ldfkjasd;lfkjasdf;lkjasdf;lkasdjf;laksdfjas;ldfkjasd;lfkjasd;lfkjasdf;lkajsdf;lkasdjf;laksdfja;sldfkjasd;lfkjasdf;lkajdfasdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsafasdfasdfasdfasdfjasd;flkasdjf;alsdfkjasd;lfkjasd;flkjasdf;lkajsdf;lkasdjf;alskdjfa;lskfjas;ldfkjasd;lfkjasdf;lkjasdf;lkasdjf;laksdfjas;ldfkjasd;lfkjasd;lfkjasdf;lkajsdf;lkasdjf;laksdfja;sldfkjasd;lfkjasdf;lkajdfasdfgsdfgsdfgsdfgsdfgsdfgsdfgsdfgdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfsafasdfasdfasdf"
|
16
9
|
);
|
17
10
|
|
18
11
|
#my $x = "004\a\b12345678\004\b\b\b\003\004\000\000\000\004\003\002\000\000\000\n\004blah\001\000\000\000p\001>\002\000\000Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\001\000\000\000q\001\000\000\000c\n\00229\017\000\000\000longer_key_name\n\020A longish string\001\000\000\000a\n\00235\001\000\000\000b";
|
19
12
|
|
20
|
-
|
13
|
+
open(FOOBAR, ">foobar.txt");
|
14
|
+
|
15
|
+
print FOOBAR Storable::nfreeze(\%blah);
|
16
|
+
|
21
17
|
|
18
|
+
close FOOBAR
|