mirror of https://github.com/junegunn/fzf
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
484 B
Go
24 lines
484 B
Go
package fzf
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/junegunn/fzf/src/util"
|
|
)
|
|
|
|
func TestStringPtr(t *testing.T) {
|
|
orig := []byte("\x1b[34mfoo")
|
|
text := []byte("\x1b[34mbar")
|
|
item := Item{origText: &orig, text: util.ToChars(text)}
|
|
if item.AsString(true) != "foo" || item.AsString(false) != string(orig) {
|
|
t.Fail()
|
|
}
|
|
if item.AsString(true) != "foo" {
|
|
t.Fail()
|
|
}
|
|
item.origText = nil
|
|
if item.AsString(true) != string(text) || item.AsString(false) != string(text) {
|
|
t.Fail()
|
|
}
|
|
}
|