summaryrefslogtreecommitdiff
path: root/dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go')
-rw-r--r--dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go b/dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go
new file mode 100644
index 00000000..1efb5f1d
--- /dev/null
+++ b/dot-oh-my-zsh/custom/plugins/fzf/src/item_test.go
@@ -0,0 +1,23 @@
+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()
+ }
+}