summaryrefslogtreecommitdiffstats
path: root/selector_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'selector_test.go')
-rw-r--r--selector_test.go31
1 files changed, 21 insertions, 10 deletions
diff --git a/selector_test.go b/selector_test.go
index 0c714dc..908d48b 100644
--- a/selector_test.go
+++ b/selector_test.go
@@ -38,7 +38,16 @@ var (
},
},
}}
- sec322 = &SectionBlock{ContentBlock{
+ sec32 = &SectionBlock{ContentBlock{
+ name: "section",
+ children: []Block{
+ &TextBlock{
+ Format: "pre",
+ Contents: TextPreContents{"zxc"},
+ },
+ },
+ }}
+ sec332 = &SectionBlock{ContentBlock{
name: "section",
args: []string{"baz"},
children: []Block{
@@ -48,7 +57,7 @@ var (
},
},
}}
- sec32 = &SectionBlock{ContentBlock{
+ sec33 = &SectionBlock{ContentBlock{
name: "section",
args: []string{"quux"},
children: []Block{
@@ -56,7 +65,7 @@ var (
Format: "pre",
Contents: TextPreContents{"123"},
},
- sec322,
+ sec332,
},
}}
sec4 = &SectionBlock{ContentBlock{
@@ -84,6 +93,7 @@ var (
children: []Block{
sec31,
sec32,
+ sec33,
&TextBlock{
Format: "pre",
Contents: TextPreContents{"rty"},
@@ -112,11 +122,12 @@ var (
name: "section",
args: sec31.Args(),
}},
+ sec32,
&SectionBlock{ContentBlock{
name: "section",
- args: sec32.Args(),
+ args: sec33.Args(),
}},
- doc1.Content.Children()[2].(ContainerBlock).Children()[2],
+ doc1.Content.Children()[2].(ContainerBlock).Children()[3],
},
}},
&SectionBlock{ContentBlock{
@@ -220,8 +231,8 @@ var selectBlockTests = []struct {
{"/foo%2fbar", doc1, sec4, []int{3}},
{"/bar/foo%2fbar", doc1, sec11, []int{0, 0}},
{"/baz", doc1, sec31, []int{2, 0}},
- {"/quux", doc1, sec32, []int{2, 1}},
- {"/quux/baz", doc1, sec322, []int{2, 1, 1}},
+ {"/quux", doc1, sec33, []int{2, 2}},
+ {"/quux/baz", doc1, sec332, []int{2, 2, 1}},
{"/bar/baz", doc1, nil, nil},
{"$", doc1, doc1.Content, []int{}},
@@ -229,11 +240,11 @@ var selectBlockTests = []struct {
{"$1", doc1, sec1, []int{0}},
{"$1.1", doc1, sec11, []int{0, 0}},
{"$2", doc1, sec31, []int{2, 0}},
- {"$3", doc1, sec32, []int{2, 1}},
+ {"$3", doc1, sec33, []int{2, 2}},
{"$4", doc1, sec4, []int{3}},
{"$5", doc1, nil, nil},
{"$2.1", doc1, nil, nil},
- {"$3.1", doc1, sec322, []int{2, 1, 1}},
+ {"$3.1", doc1, sec332, []int{2, 2, 1}},
{"$3.0", doc1, nil, nil},
{"$3.2", doc1, nil, nil},
@@ -242,7 +253,7 @@ var selectBlockTests = []struct {
{"#bar", doc1, sec1, []int{0}},
{"#foo%2fbar", doc1, sec11, []int{0, 0}},
{"#baz", doc1, sec31, []int{2, 0}},
- {"#quux", doc1, sec32, []int{2, 1}},
+ {"#quux", doc1, sec33, []int{2, 2}},
}
func TestSelectBlock(t *testing.T) {