Skip to content

Commit

Permalink
#555 fromRdf-manifest.jsonld#t0027 covers fallback logic in `useNat…
Browse files Browse the repository at this point in the history
…iveTypes` mode
  • Loading branch information
anatoly-scherbakov committed Jan 12, 2025
1 parent 9f6ad38 commit e5ec756
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/fromRdf-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,16 @@
"purpose": "Check list generation with rdf:first property and rdf:nil value.",
"input": "fromRdf/0026-in.nq",
"expect": "fromRdf/0026-out.jsonld"
}, {
"@id": "#t0027",
"@type": ["jld:PositiveEvaluationTest", "jld:FromRDFTest"],
"name": "use native types flag with values that cannot be serialized to JSON",
"purpose": "useNativeTypes flag being true is disregarded for a value that cannot be serialized into a native JSON value.",
"option": {
"useNativeTypes": true
},
"input": "fromRdf/0027-in.nq",
"expect": "fromRdf/0027-out.jsonld"
}, {
"@id": "#tdi01",
"@type": [ "jld:PositiveEvaluationTest", "jld:FromRDFTest" ],
Expand Down
12 changes: 12 additions & 0 deletions tests/fromRdf/0027-in.nq
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<http://example.com/boolean-native> <http://example.com/example> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/boolean-native> <http://example.com/example> "false"^^<http://www.w3.org/2001/XMLSchema#boolean> .

<http://example.com/boolean-object> <http://example.com/example> "True"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<http://example.com/boolean-object> <http://example.com/example> "False"^^<http://www.w3.org/2001/XMLSchema#boolean> .

<http://example.com/number-native> <http://example.com/example> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://example.com/number-native> <http://example.com/example> "1.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .

<http://example.com/number-object> <http://example.com/example> "0.1e999999999999999"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/number-object> <http://example.com/example> "+INF"^^<http://www.w3.org/2001/XMLSchema#double> .
<http://example.com/number-object> <http://example.com/example> "-INF"^^<http://www.w3.org/2001/XMLSchema#double> .
60 changes: 60 additions & 0 deletions tests/fromRdf/0027-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"@graph": [
{
"@id": "http://example.com/boolean-native",
"http://example.com/example": [
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": true
},
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": false
}
]
},
{
"@id": "http://example.com/boolean-object",
"http://example.com/example": [
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": "True"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#boolean",
"@value": "False"
}
]
},
{
"@id": "http://example.com/number-native",
"http://example.com/example": [
{
"@type": "http://www.w3.org/2001/XMLSchema#integer",
"@value": 1
},
{
"@type": "http://www.w3.org/2001/XMLSchema#decimal",
"@value": 1.1
}
]
},
{
"@id": "http://example.com/number-object",
"http://example.com/example": [
{
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": "0.1e999999999999999"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": "+INF"
},
{
"@type": "http://www.w3.org/2001/XMLSchema#double",
"@value": "-INF"
}
]
}
]
}

0 comments on commit e5ec756

Please sign in to comment.