Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go
987 B
Raw Blame
package agent

import (
	"io"
	"log/slog"
	"path/filepath"
	"reflect"
	"testing"
)

// TestChooseQwenInvocation_PassthroughForNonLauncher verifies that when the
// resolved executable is not a Windows .cmd/.bat launcher, both argv[0] and
// the argv list are returned unchanged on every platform. This guards against
// accidental rewriting on macOS/Linux and for direct binary launches on
// Windows.
func TestChooseQwenInvocation_PassthroughForNonLauncher(t *testing.T) {
	logger := slog.New(slog.NewTextHandler(io.Discard, nil))

	execName := "qwen"
	lookedUp := filepath.Join(t.TempDir(), "qwen") // no .cmd / .bat
	args := []string{"--output-format", "stream-json", "--yolo"}

	gotExec, gotArgs := chooseQwenInvocation(execName, lookedUp, args, logger)

	if gotExec != execName {
		t.Errorf("argv0 changed unexpectedly: got %q want %q", gotExec, execName)
	}
	if !reflect.DeepEqual(gotArgs, args) {
		t.Errorf("argv changed unexpectedly:\n got  %#v\n want %#v", gotArgs, args)
	}
}