install.fairie/dotfiles/.vim/plugged/fzf/src/item_test.go
Git E2E Dev Test Username 8c6fca48ea git subrepo clone https://github.com/junegunn/fzf.git ./dotfiles/.vim/plugged/fzf
subrepo:
  subdir:   "dotfiles/.vim/plugged/fzf"
  merged:   "dad26d81d"
upstream:
  origin:   "https://github.com/junegunn/fzf.git"
  branch:   "master"
  commit:   "dad26d81d"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"
2022-10-18 10:37:14 -04:00

23 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()
}
}