Merge pull request '[agent/codex:gpt-5.4-mini] Read ~/spec/code/core/go/cli/RFC.md fully. Find features des...' (#84) from agent/read---spec-code-core-go-cli-rfc-md-full into dev
All checks were successful
Security Scan / security (push) Successful in 21s
All checks were successful
Security Scan / security (push) Successful in 21s
This commit is contained in:
commit
b5e67b2430
6 changed files with 34 additions and 5 deletions
|
|
@ -95,5 +95,5 @@ func StaticModel(text string) Model {
|
|||
}
|
||||
|
||||
func (s *staticModel) View(_, _ int) string {
|
||||
return s.text
|
||||
return compileGlyphs(s.text)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,8 +233,11 @@ func TestFrameComponents_GlyphShortcodes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStaticModel_Good(t *testing.T) {
|
||||
m := StaticModel("hello")
|
||||
assert.Equal(t, "hello", m.View(80, 24))
|
||||
restoreThemeAndColors(t)
|
||||
UseASCII()
|
||||
|
||||
m := StaticModel(":check: hello")
|
||||
assert.Equal(t, "[OK] hello", m.View(80, 24))
|
||||
}
|
||||
|
||||
func TestFrameModel_Good(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ type Renderable interface {
|
|||
type StringBlock string
|
||||
|
||||
// Render returns the string content.
|
||||
func (s StringBlock) Render() string { return string(s) }
|
||||
func (s StringBlock) Render() string { return compileGlyphs(string(s)) }
|
||||
|
||||
// Layout creates a new layout from a variant string.
|
||||
func Layout(variant string) *Composite {
|
||||
|
|
|
|||
|
|
@ -23,3 +23,13 @@ func TestParseVariant(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestStringBlock_GlyphShortcodes(t *testing.T) {
|
||||
restoreThemeAndColors(t)
|
||||
UseASCII()
|
||||
|
||||
block := StringBlock(":check: ready")
|
||||
if got := block.Render(); got != "[OK] ready" {
|
||||
t.Fatalf("expected shortcode rendering, got %q", got)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,5 +141,5 @@ func (s *Stream) Captured() string {
|
|||
if st, ok := s.out.(fmt.Stringer); ok {
|
||||
return st.String()
|
||||
}
|
||||
return ""
|
||||
panic("stream output writer does not support Capture")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package cli
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
|
@ -187,4 +188,19 @@ func TestStream_Bad(t *testing.T) {
|
|||
|
||||
assert.Equal(t, "", buf.String())
|
||||
})
|
||||
|
||||
t.Run("Captured panics when output is not stringable", func(t *testing.T) {
|
||||
s := NewStream(WithStreamOutput(writerOnly{}))
|
||||
assert.Panics(t, func() {
|
||||
_ = s.Captured()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
type writerOnly struct{}
|
||||
|
||||
func (writerOnly) Write(p []byte) (int, error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
var _ io.Writer = writerOnly{}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue