Commits

Miki Tebeka committed a4c787b

minimal test

  • Participants
  • Parent commits 425da5f

Comments (0)

Files changed (2)

 // Example:
 //  stemmer = snowball.New("en")
 //  fmt.Println(stemmer.stem("running")) // Will print "run"
-package main
+package snowball
 
 import (
 	"fmt"
 
 // FIXME: Currently cgo does not find the source files in libstemmer_c/
 
-// #include "libstemmer_c/include/libstemmer.h"
+// #cgo CFLAGS: -Ilibstemmer_c/include
+// #include "libstemmer.h"
 import "C"
 
 type Stemmer struct {

File snowball_test.go

+package snowball
+
+import (
+	"testing"
+)
+
+func TestStem(t *testing.T) {
+	stemmer = New("en")
+	word = "running"
+	stemmed = stemmer.Stem(word)
+	if stemmed != "run" {
+		t.Fatalf("stem(%s) -> '%s' (expected 'run')", word, stemmed)
+	}
+}