Skip to content

Commit 3714197

Browse files
committed
language map tests.
1 parent 86b8304 commit 3714197

File tree

1 file changed

+43
-3
lines changed

1 file changed

+43
-3
lines changed

spec/compact_spec.rb

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,47 @@
292292
},
293293
"http://example.org/vocab#contains": "this-is-not-an-IRI"
294294
})
295-
}
295+
},
296+
"Language map term with language value" => {
297+
input: %([{"http://example/t": {"@value": "foo", "@language": "en"}}]),
298+
context: %({"t": {"@id": "http://example/t", "@container": "@language"}}),
299+
output: %({
300+
"@context": {
301+
"t": {"@id": "http://example/t", "@container": "@language"}
302+
},
303+
"t": {"en": "foo"}
304+
})
305+
},
306+
"Datatyped term with datatyped value" => {
307+
input: %([{"http://example/t": {"@value": "foo", "@type": "http:/example/type"}}]),
308+
context: %({"t": {"@id": "http://example/t", "@type": "http:/example/type"}}),
309+
output: %({
310+
"@context": {
311+
"t": {"@id": "http://example/t", "@type": "http:/example/type"}
312+
},
313+
"t": "foo"
314+
})
315+
},
316+
"Datatyped term with simple value" => {
317+
input: %([{"http://example/t": {"@value": "foo"}}]),
318+
context: %({"t": {"@id": "http://example/t", "@type": "http:/example/type"}}),
319+
output: %({
320+
"@context": {
321+
"t": {"@id": "http://example/t", "@type": "http:/example/type"}
322+
},
323+
"http://example/t": "foo"
324+
})
325+
},
326+
"Datatyped term with object value" => {
327+
input: %([{"http://example/t": {"@id": "http://example/id"}}]),
328+
context: %({"t": {"@id": "http://example/t", "@type": "http:/example/type"}}),
329+
output: %({
330+
"@context": {
331+
"t": {"@id": "http://example/t", "@type": "http:/example/type"}
332+
},
333+
"http://example/t": {"@id": "http://example/id"}
334+
})
335+
},
296336
}.each_pair do |title, params|
297337
it(title) {run_compact(params)}
298338
end
@@ -2140,12 +2180,12 @@
21402180

21412181
context "compact IRI selection" do
21422182
{
2143-
"compacts using expanded term in 1.0" => {
2183+
"does not compact using expanded term in 1.0" => {
21442184
input: %({"http://example.org/foo": "term"}),
21452185
context: %({"ex": {"@id": "http://example.org/"}}),
21462186
output: %({
21472187
"@context": {"ex": {"@id": "http://example.org/"}},
2148-
"ex:foo": "term"
2188+
"http://example.org/foo": "term"
21492189
}),
21502190
processingMode: "json-ld-1.0"
21512191
},

0 commit comments

Comments
 (0)