mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-05 00:45:29 +08:00
24 lines
708 B
Go
24 lines
708 B
Go
package openai
|
|
|
|
import "testing"
|
|
|
|
func TestFindQuotedFunctionCallKeyStart_PrefersEarlierBareKey(t *testing.T) {
|
|
input := `{functionCall:{"name":"a","arguments":"{}"},"message":"literal text: \"functionCall\": not a key"}`
|
|
|
|
got := findQuotedFunctionCallKeyStart(input)
|
|
want := 1
|
|
if got != want {
|
|
t.Fatalf("findQuotedFunctionCallKeyStart() = %d, want %d", got, want)
|
|
}
|
|
}
|
|
|
|
func TestFindQuotedFunctionCallKeyStart_PrefersEarlierQuotedKey(t *testing.T) {
|
|
input := `{"functionCall":{"name":"a","arguments":"{}"},"note":"functionCall appears in prose"}`
|
|
|
|
got := findQuotedFunctionCallKeyStart(input)
|
|
want := 1
|
|
if got != want {
|
|
t.Fatalf("findQuotedFunctionCallKeyStart() = %d, want %d", got, want)
|
|
}
|
|
}
|