mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 01:47:51 +08:00
23 lines
420 B
Go
23 lines
420 B
Go
package vals
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/elves/elvish/tt"
|
|
)
|
|
|
|
func TestToString(t *testing.T) {
|
|
tt.Test(t, tt.Fn("ToString", ToString), tt.Table{
|
|
// string
|
|
tt.Args("a").Rets("a"),
|
|
// float64
|
|
tt.Args(42.0).Rets("42"),
|
|
tt.Args(0.1).Rets("0.1"),
|
|
// Stringer
|
|
tt.Args(bytes.NewBufferString("buffer")).Rets("buffer"),
|
|
// None of the above: delegate to Repr
|
|
tt.Args(true).Rets("$true"),
|
|
})
|
|
}
|