okami.mom/web-extract-go
git clone https://git.nkp.pet/okami.mom/web-extract-go
0dcfeb8
main
1package app 2 3import "testing" 4 5func TestAfterThinking (t * testing.T ) { 6cases := []struct {name ,in ,want string }{ 7 {"no tag is unchanged" ,"## Answer\n\nPlain text [1]." ,"## Answer\n\nPlain text [1]." }, 8 {"reasoning tail is dropped" ,"Let me write a clear, grounded answer.\n</think>\n\n## Answer\n\nText [1]." ,"## Answer\n\nText [1]." }, 9 {"last close tag wins" ,"a </think> b\n</think>\n## Answer" ,"## Answer" }, 10 {"only reasoning leaves nothing" ,"still thinking\n</think>\n" ,"" }, 11 } 12for _ ,c := range cases { 13if got := afterThinking (c .in );got != c .want { 14t .Errorf ("%s: got %q, want %q" ,c .name ,got ,c .want ) 15 } 16 } 17if err := usableSummary (afterThinking ("still thinking\n</think>" ));err == nil { 18t .Error ("a reply that is only reasoning should be rejected as empty" ) 19 } 20}