Permalink
Browse files

Update from_rdf specs to use both useNativeTypes true and false.

  • Loading branch information...
1 parent 7eab290 commit c730377d5c9307dbf8118032ccbfd4cbd7338d94 @gkellogg committed Sep 5, 2012
Showing with 27 additions and 3 deletions.
  1. +1 −1 Gemfile.lock
  2. +26 −2 spec/from_rdf_spec.rb
View
@@ -16,7 +16,7 @@ PATH
PATH
remote: ../rdf-spec
specs:
- rdf-spec (0.3.5)
+ rdf-spec (0.3.8)
rspec (>= 2.8.0)
GEM
View
@@ -66,6 +66,14 @@
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
serialize(input).should produce([{
'@id' => "http://example.com/a",
+ "http://example.com/b" => [{"@value" => 1}]
+ }], @debug)
+ end
+
+ it "integer (non-native)" do
+ input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1 .)
+ serialize(input, :useNativeTypes => false).should produce([{
+ '@id' => "http://example.com/a",
"http://example.com/b" => [{"@value" => "1","@type" => "http://www.w3.org/2001/XMLSchema#integer"}]
}], @debug)
end
@@ -74,6 +82,14 @@
input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
serialize(input).should produce([{
'@id' => "http://example.com/a",
+ "http://example.com/b" => [{"@value" => true}]
+ }], @debug)
+ end
+
+ it "boolean (non-native)" do
+ input = %(@prefix ex: <http://example.com/> . ex:a ex:b true .)
+ serialize(input, :useNativeTypes => false).should produce([{
+ '@id' => "http://example.com/a",
"http://example.com/b" => [{"@value" => "true","@type" => "http://www.w3.org/2001/XMLSchema#boolean"}]
}], @debug)
end
@@ -90,12 +106,20 @@
input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
serialize(input).should produce([{
'@id' => "http://example.com/a",
+ "http://example.com/b" => [{"@value" => 1.0E0}]
+ }], @debug)
+ end
+
+ it "double (non-native)" do
+ input = %(@prefix ex: <http://example.com/> . ex:a ex:b 1.0e0 .)
+ serialize(input, :useNativeTypes => false).should produce([{
+ '@id' => "http://example.com/a",
"http://example.com/b" => [{"@value" => "1.0E0","@type" => "http://www.w3.org/2001/XMLSchema#double"}]
}], @debug)
end
end
- context "datatyped" do
+ context "datatyped (non-native)" do
{
:integer => 1,
:unsignedInteger => 1,
@@ -110,7 +134,7 @@
@prefix ex: <http://example.com/> .
ex:a ex:b "#{v}"^^xsd:#{t} .
)
- serialize(input).should produce([{
+ serialize(input, :useNativeTypes => false).should produce([{
'@id' => "http://example.com/a",
"http://example.com/b" => [{"@value" => "#{v}","@type" => "http://www.w3.org/2001/XMLSchema##{t}"}]
}], @debug)

0 comments on commit c730377

Please sign in to comment.