test/decode_spec.rb in erlectricity-0.2.0 vs test/decode_spec.rb in erlectricity-0.2.1
- old
+ new
@@ -114,10 +114,16 @@
specify "an erlang binary should decode to a string" do
get("<< 3,4,255 >>").should == "\003\004\377"
get("<< \"whatup\" >>").should == "whatup"
end
+ specify "a good thing should be awesome" do
+ get(%Q-[{options,{struct,[{test,<<"I'm chargin' mah lazer">>}]}},{passage,<<"Why doesn't this work?">>}]-).should ==
+ [[:options, [:struct, [[:test, "I'm chargin' mah lazer"]]]], [:passage, "Why doesn't this work?"]]
+ end
+
def get(str)
- bin = run_erl("term_to_binary(#{str})")
+ x = "term_to_binary(#{str.gsub(/"/, '\\\"')})"
+ bin = run_erl(x)
Erlectricity::Decoder.read_any_from(bin)
end
end
\ No newline at end of file