Ugh, Yaml has a <<: merge key. facepalm: true
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
a:
|
||||
extends: b
|
||||
x: 50
|
||||
b:
|
||||
extends: a
|
||||
x: 150
|
||||
@@ -1,9 +0,0 @@
|
||||
a:
|
||||
extends: c
|
||||
x: 50
|
||||
b:
|
||||
extends: a
|
||||
x: 150
|
||||
c:
|
||||
extends: b
|
||||
y: 250
|
||||
@@ -1,14 +1,13 @@
|
||||
aunt:
|
||||
aunt: &aunt
|
||||
a: 101
|
||||
b: 102
|
||||
c: 103
|
||||
uncle:
|
||||
uncle: &uncle
|
||||
x: 104
|
||||
y: 105
|
||||
b: 106
|
||||
child:
|
||||
extends:
|
||||
- uncle
|
||||
- aunt
|
||||
<<: *uncle
|
||||
<<: *aunt
|
||||
a: 107
|
||||
x: 108
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
frame:
|
||||
frame: &frame
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
extends: frame
|
||||
title: &title
|
||||
<<: *frame
|
||||
y: 50
|
||||
width: 100
|
||||
subtitle:
|
||||
extends: title
|
||||
subtitle:
|
||||
<<: *title
|
||||
y: 150
|
||||
@@ -1,7 +0,0 @@
|
||||
title:
|
||||
extends: frame
|
||||
y: 50
|
||||
width: 100
|
||||
frame:
|
||||
x: 38
|
||||
y: 38
|
||||
@@ -1,3 +0,0 @@
|
||||
a:
|
||||
extends: a
|
||||
x: 50
|
||||
@@ -1,7 +1,7 @@
|
||||
frame:
|
||||
frame: &frame
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
extends: frame
|
||||
<<: *frame
|
||||
y: 50
|
||||
width: 100
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
frame:
|
||||
frame: &frame
|
||||
x: 38
|
||||
y: 38
|
||||
title:
|
||||
extends: frame
|
||||
<<: *frame
|
||||
y: 50
|
||||
width: 100
|
||||
title2:
|
||||
extends: frame
|
||||
<<: *frame
|
||||
x: 75
|
||||
y: 150
|
||||
width: 150
|
||||
@@ -68,24 +68,6 @@ describe Squib::Deck do
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
}
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it "applies the extends regardless of order" do
|
||||
d = Squib::Deck.new(layout: test_file('pre-extends.yml'))
|
||||
expect(d.layout).to \
|
||||
eq({'frame' => {
|
||||
'x' => 38,
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
@@ -102,13 +84,11 @@ describe Squib::Deck do
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
},
|
||||
'title2' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 75,
|
||||
'y' => 150,
|
||||
'width' => 150,
|
||||
@@ -131,7 +111,6 @@ describe Squib::Deck do
|
||||
'b' => 106,
|
||||
},
|
||||
'child' => {
|
||||
'extends' => ['uncle','aunt'],
|
||||
'a' => 107, # my own
|
||||
'b' => 102, # from the younger aunt
|
||||
'c' => 103, # from aunt
|
||||
@@ -150,13 +129,11 @@ describe Squib::Deck do
|
||||
'y' => 38,
|
||||
},
|
||||
'title' => {
|
||||
'extends' => 'frame',
|
||||
'x' => 38,
|
||||
'y' => 50,
|
||||
'width' => 100,
|
||||
},
|
||||
'subtitle' => {
|
||||
'extends' => 'title',
|
||||
'x' => 38,
|
||||
'y' => 150,
|
||||
'width' => 100,
|
||||
@@ -165,24 +142,6 @@ describe Squib::Deck do
|
||||
)
|
||||
end
|
||||
|
||||
it "fails on a self-circular extends" do
|
||||
file = test_file('self-circular-extends.yml')
|
||||
expect { Squib::Deck.new(layout: file) }.to \
|
||||
raise_error(RuntimeError, "Invalid layout: circular extends with 'a'")
|
||||
end
|
||||
|
||||
it "fails on a easy-circular extends" do
|
||||
file = test_file('easy-circular-extends.yml')
|
||||
expect { Squib::Deck.new(layout: file) }.to \
|
||||
raise_error(RuntimeError, "Invalid layout: circular extends with 'a'")
|
||||
end
|
||||
|
||||
it "hard on a easy-circular extends" do
|
||||
file = test_file('hard-circular-extends.yml')
|
||||
expect { Squib::Deck.new(layout: file) }.to \
|
||||
raise_error(RuntimeError, "Invalid layout: circular extends with 'a'")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user