-
Notifications
You must be signed in to change notification settings - Fork 11
/
piece_test.go
33 lines (29 loc) · 871 Bytes
/
piece_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package main_test
import (
"testing"
)
func TestPiece(t *testing.T) {
testCases(t, "Piece raw html", []testCase{
{"piece_raw_a", []string{
"-i", "opt_piece_attr.html", "-o", "-c", "ul > li", "-p", "Source=RAW:a",
}},
})
testCases(t, "Piece Attributes", []testCase{
{"id", []string{
"-i", "opt_piece_attr.html", "-o", "-c", "li > a", "-p", "id=ATTR:id",
}},
{"href", []string{
"-i", "opt_piece_attr.html", "-o", "-c", "li > a", "-p", "url=ATTR:href",
}},
{"both_fields", []string{"-i", "opt_piece_attr.html", "-o", "-c", "li > a",
"-p", "id=ATTR:id", "-p", "url=ATTR:href",
}},
{"noexist", []string{
"-i", "opt_piece_attr.html", "-o", "-c", "li > a", "-p", "NoExist=ATTR:noexist",
}},
{"script_src", []string{
"-i", "opt_piece_script.html", "-o", "-c", "html > head > script", "-p", "SourceJS=ATTR:src",
}},
//{},
})
}