Skip to content

Commit 2610c8c

Browse files
committed
Add acceptance tests
1 parent 376df12 commit 2610c8c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cmd/root.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ func referenceCmd(results httpref.References) func(cmd *cobra.Command, args []st
129129

130130
func portsReference() func(cmd *cobra.Command, args []string) {
131131
return func(cmd *cobra.Command, args []string) {
132+
if searchTerm != "" {
133+
fmt.Fprintf(os.Stderr, "error: full-text search not supported\n")
134+
os.Exit(1)
135+
}
136+
132137
ref := append(httpref.WellKnownPorts, httpref.RegisteredPorts...)
133138
var results httpref.References
134139

test/basic.bats

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ BIN=./httpref
5959
[ "$(echo $output | grep -c '/docs/Web/HTTP/Headers/Accept$')" -eq 1 ]
6060
}
6161

62+
@test "Full-text search option works on root" {
63+
run ${BIN} --search clear
64+
[ $status -eq 0 ]
65+
}
66+
67+
@test "Full-text search option works on headers" {
68+
run ${BIN} headers --search cache
69+
[ $status -eq 0 ]
70+
}
71+
72+
@test "Full-text search option works on methods" {
73+
run ${BIN} methods --search cache
74+
[ $status -eq 0 ]
75+
}
76+
77+
@test "Full-text search option works on statuses" {
78+
run ${BIN} statuses --search cache
79+
[ $status -eq 0 ]
80+
}
81+
82+
@test "Full-text search option does NOT work on ports" {
83+
run ${BIN} ports --search cache
84+
[ $status -eq 1 ]
85+
}
86+
6287
@test "Can change the width of the output" {
6388
run ${BIN} -w 70 100
6489
[ $status -eq 0 ]

0 commit comments

Comments
 (0)