item_test.go
This file
1package fzf23import (4 "testing"56 "github.com/junegunn/fzf/src/util"7)89func TestStringPtr(t *testing.T) {10 orig := []byte("\x1b[34mfoo")11 text := []byte("\x1b[34mbar")12 item := Item{origText: &orig, text: util.ToChars(text)}13 if item.AsString(true) != "foo" || item.AsString(false) != string(orig) {14 t.Fail()15 }16 if item.AsString(true) != "foo" {17 t.Fail()18 }19 item.origText = nil20 if item.AsString(true) != string(text) || item.AsString(false) != string(text) {21 t.Fail()22 }23}