Skip to content

Commit 26ef389

Browse files
committed
test(WO80/A4): normative rulings for parallel composition
Two rulings pinned as frozen vectors: a parallel block is single-pass longest-match; duplicate rules resolve last-declared-wins. Each A4 ruling lands this way -- empirical vectors first, the IS-1 v2 normative text accretes per ruled point.
1 parent 8d6d0c1 commit 26ef389

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

‎spec/isc/semantics_spec.rb‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# frozen_string_literal: true
2+
3+
# WO80/A4 — normative rulings for the ISC semantic surface. Each vector
4+
# pins the reference behavior; IS-1 v2 documents these as normative
5+
# sections (the spec text accretes one section per ruled point).
6+
7+
require "tmpdir"
8+
9+
RSpec.describe "ISC semantics — parallel composition" do
10+
def with_map(name, body)
11+
dir = Dir.mktmpdir
12+
File.write(File.join(dir, name), body)
13+
Interscript.load_path.unshift(dir)
14+
yield
15+
ensure
16+
Interscript.load_path.delete(dir) if dir
17+
end
18+
19+
it "rules: a parallel block is single-pass longest-match" do
20+
with_map("tst-long-1.isc", <<~ISC) do
21+
system "TST:xx-Latn:Latn:1" {
22+
metadata {
23+
authority_id tst
24+
id 1
25+
language iso-639-2:xx
26+
source_script Latn
27+
destination_script Latn
28+
}
29+
stage main { parallel {
30+
sub "b" "Y"
31+
sub "ab" "X"
32+
} }
33+
}
34+
ISC
35+
expect(Interscript.transliterate("tst-long-1", "ab")).to eq("X")
36+
end
37+
end
38+
39+
it "rules: duplicate rules in a parallel resolve last-declared-wins" do
40+
with_map("tst-tie-1.isc", <<~ISC) do
41+
system "TST:xx-Latn:Latn:2" {
42+
metadata {
43+
authority_id tst
44+
id 2
45+
language iso-639-2:xx
46+
source_script Latn
47+
destination_script Latn
48+
}
49+
stage main { parallel {
50+
sub "a" "1"
51+
sub "a" "2"
52+
} }
53+
}
54+
ISC
55+
expect(Interscript.transliterate("tst-tie-1", "a")).to eq("2")
56+
end
57+
end
58+
end

0 commit comments

Comments
 (0)