Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des...' (#93) from agent/read---spec-code-core-go-cli-rfc-md-full into dev
All checks were successful
Security Scan / security (push) Successful in 20s
All checks were successful
Security Scan / security (push) Successful in 20s
This commit is contained in:
commit
d65aebd298
2 changed files with 19 additions and 1 deletions
|
|
@ -132,7 +132,7 @@ func Label(word, value string) {
|
|||
|
||||
// Scanln reads from stdin.
|
||||
func Scanln(a ...any) (int, error) {
|
||||
return fmt.Scanln(a...)
|
||||
return fmt.Fscanln(newReader(), a...)
|
||||
}
|
||||
|
||||
// Task prints a task header: "[label] message"
|
||||
|
|
|
|||
|
|
@ -141,3 +141,21 @@ func TestSection_GlyphTheme(t *testing.T) {
|
|||
t.Fatalf("expected glyph theme to avoid unicode dashes, got %q", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestScanln_UsesOverrideStdin(t *testing.T) {
|
||||
SetStdin(strings.NewReader("hello\n"))
|
||||
defer SetStdin(nil)
|
||||
|
||||
var got string
|
||||
n, err := Scanln(&got)
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("Scanln returned error: %v", err)
|
||||
}
|
||||
if n != 1 {
|
||||
t.Fatalf("expected 1 scanned item, got %d", n)
|
||||
}
|
||||
if got != "hello" {
|
||||
t.Fatalf("expected %q, got %q", "hello", got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue