Skip to content

Commit

Permalink
chore: Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ikawaha committed Oct 24, 2024
1 parent be538d6 commit e871276
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions cmd/server/demo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"io"
"net/http"
"net/http/httptest"
"os/exec"
"reflect"
"strings"
"testing"
Expand Down Expand Up @@ -60,9 +59,6 @@ func TestTokenizeDemoHandler_ServeHTTP(t *testing.T) {
})

t.Run("w/ lattice", func(t *testing.T) {
if _, err := exec.LookPath(graphvizCmd); err != nil {
t.Skipf("graphviz command not found, %v", err)
}
req := httptest.NewRequest(http.MethodPost, `/?s=ねこです&r=Search&lattice=true`, nil)
w := httptest.NewRecorder()
(&TokenizeDemoHandler{tokenizer: tnz}).ServeHTTP(w, req)
Expand All @@ -86,9 +82,6 @@ func TestTokenizeDemoHandler_ServeHTTP(t *testing.T) {
}

func TestTokenizeDemoHandler_analyzeGraph(t *testing.T) {
if _, err := exec.LookPath(graphvizCmd); err != nil {
t.Skipf("graphviz command not found, %v", err)
}
tnz, err := tokenizer.New(loadTestDict(t))
if err != nil {
t.Fatalf("unexpected error, %v", err)
Expand Down Expand Up @@ -116,11 +109,8 @@ func TestTokenizeDemoHandler_analyzeGraph(t *testing.T) {
}; !reflect.DeepEqual(got, want) {
t.Errorf("got %+v, want %v", got, want)
}
if !strings.HasPrefix(svg, "<svg width=") {
if len(svg) > 50 {
svg = svg[:50]
}
t.Errorf("broken svg, %s", svg)
if len(svg) == 0 {
t.Errorf("svg is empty")
}
}

Expand Down

0 comments on commit e871276

Please sign in to comment.