mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-04-13 21:57:29 +08:00
enhance memory_write metadata and add /lang command
This commit is contained in:
28
pkg/tools/memory_write_test.go
Normal file
28
pkg/tools/memory_write_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFormatMemoryLine(t *testing.T) {
|
||||
got := formatMemoryLine("remember this", "high", "user", []string{"preference", "lang"})
|
||||
if got == "" {
|
||||
t.Fatal("empty formatted line")
|
||||
}
|
||||
if want := "importance=high"; !strings.Contains(got, want) {
|
||||
t.Fatalf("expected %q in %q", want, got)
|
||||
}
|
||||
if want := "source=user"; !strings.Contains(got, want) {
|
||||
t.Fatalf("expected %q in %q", want, got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeImportance(t *testing.T) {
|
||||
if normalizeImportance("HIGH") != "high" {
|
||||
t.Fatal("expected high")
|
||||
}
|
||||
if normalizeImportance("unknown") != "medium" {
|
||||
t.Fatal("expected medium fallback")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user