spec/edn_spec.rb in edn-1.0.2 vs spec/edn_spec.rb in edn-1.0.3
- old
+ new
@@ -3,10 +3,11 @@
describe EDN do
include RantlyHelpers
context "#read" do
it "reads single elements" do
+ EDN.read(%q{""}).should == ""
EDN.read("1").should == 1
EDN.read("3.14").should == 3.14
EDN.read("3.14M").should == BigDecimal("3.14")
EDN.read('"hello\nworld"').should == "hello\nworld"
EDN.read(':hello').should == :hello
@@ -67,9 +68,23 @@
end
rescue Exception => ex
puts "Bad element: #{element}"
raise ex
end
+ end
+ end
+
+ context "allows symbols starting with a reserved word" do
+ it "reads true-foo" do
+ EDN.read('true-foo').should == EDN::Type::Symbol.new('true-foo')
+ end
+
+ it "reads falsey" do
+ EDN.read('falsey').should == EDN::Type::Symbol.new('falsey')
+ end
+
+ it "reads nillable" do
+ EDN.read('nillable').should == EDN::Type::Symbol.new('nillable')
end
end
end
context "#register" do