21 lines
567 B
Go
21 lines
567 B
Go
|
|
package knowledge
|
||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestPatrolTagFromQuestionPreservesSearchPhrase(t *testing.T) {
|
||
|
|
got := PatrolTagFromQuestion("化療後皮膚敏感要換什麼沐浴乳")
|
||
|
|
if got != "化療後皮膚敏感要換什麼沐浴乳" {
|
||
|
|
t.Fatalf("expected preserved question, got %q", got)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestPatrolTagFromQuestionCompressesGenericLabel(t *testing.T) {
|
||
|
|
got := PatrolTagFromQuestion("敏感肌保養")
|
||
|
|
if got == "敏感肌保養" {
|
||
|
|
t.Fatal("expected compression for generic short label")
|
||
|
|
}
|
||
|
|
if got == "" {
|
||
|
|
t.Fatal("expected non-empty tag")
|
||
|
|
}
|
||
|
|
}
|