38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
|
|
package winlimit
|
||
|
|
|
||
|
|
import (
|
||
|
|
"runtime"
|
||
|
|
"strings"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestNonWindowsPassThrough(t *testing.T) {
|
||
|
|
if runtime.GOOS == "windows" {
|
||
|
|
t.Skip("Skipping non-Windows test on Windows")
|
||
|
|
}
|
||
|
|
|
||
|
|
fixedArgs := []string{"--print", "--model", "gpt-4"}
|
||
|
|
prompt := "Hello world"
|
||
|
|
result := FitPromptToWinCmdline("agent", fixedArgs, prompt, 30000, "/tmp")
|
||
|
|
|
||
|
|
if !result.OK {
|
||
|
|
t.Fatalf("expected OK=true on non-Windows, got error: %s", result.Error)
|
||
|
|
}
|
||
|
|
if result.Truncated {
|
||
|
|
t.Error("expected no truncation on non-Windows")
|
||
|
|
}
|
||
|
|
if result.OriginalLength != len(prompt) {
|
||
|
|
t.Errorf("expected original length %d, got %d", len(prompt), result.OriginalLength)
|
||
|
|
}
|
||
|
|
// Last arg should be the prompt
|
||
|
|
if len(result.Args) == 0 || result.Args[len(result.Args)-1] != prompt {
|
||
|
|
t.Errorf("expected last arg to be prompt, got %v", result.Args)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestOmissionPrefix(t *testing.T) {
|
||
|
|
if !strings.Contains(WinPromptOmissionPrefix, "Earlier messages omitted") {
|
||
|
|
t.Errorf("omission prefix should mention earlier messages, got: %q", WinPromptOmissionPrefix)
|
||
|
|
}
|
||
|
|
}
|