10000 Nicer buildChain · golang/net@72158c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 72158c5

Browse files
committed
Nicer buildChain
1 parent 8aa2ef1 commit 72158c5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

html/iter_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,13 @@ func TestNode_Parents(t *testing.T) {
8383
}
8484

8585
func buildChain(size int) *Node {
86-
descendent := new(Node)
87-
current := descendent
86+
child := new(Node)
8887
for range size {
89-
parent := new(Node)
90-
parent.AppendChild(current)
91-
current = parent
88+
parent := child
89+
child = new(Node)
90+
parent.AppendChild(child)
9291
}
93-
return descendent
92+
return child
9493
}
9594

9695
func testParents(t *testing.T, n *Node, wantSize int) {

0 commit comments

Comments
 (0)
0