aboutsummaryrefslogtreecommitdiffstats
path: root/lettersnail_test.go
diff options
context:
space:
mode:
authorClemens Fries <github-lettersnail@xenoworld.de>2018-11-25 11:06:32 +0100
committerClemens Fries <github-lettersnail@xenoworld.de>2018-11-25 11:06:32 +0100
commiteac80b3843dbd94de2fc00e29c885dd90e261679 (patch)
tree377672a2a7a00d976dfdae579e42421aba7cec78 /lettersnail_test.go
parent324319bb816cf52f516dbe828a4e4495148939ec (diff)
Rename project from 'clockrotz' to 'lettersnail'
You can't always wait for the right name to appear before starting a project, so I chose a strange name that wasn't good. I finally came up with a name I like.
Diffstat (limited to 'lettersnail_test.go')
-rw-r--r--lettersnail_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/lettersnail_test.go b/lettersnail_test.go
new file mode 100644
index 0000000..0b2bdbe
--- /dev/null
+++ b/lettersnail_test.go
@@ -0,0 +1,34 @@
+package main
+
+import (
+ "github.com/stretchr/testify/assert"
+ "testing"
+ . "github.com/githubert/lettersnail/common"
+)
+
+func TestExpandTilde(t *testing.T) {
+ c := NewConfiguration()
+
+ c.Set(CONF_WORKDIR, "/foo")
+ expandTilde(c)
+ assert.Equal(t, "/foo", c.Get(CONF_WORKDIR))
+
+ c.Set(CONF_WORKDIR, "~/foo")
+ expandTilde(c)
+ assert.Equal(t, userHome() + "/foo", c.Get(CONF_WORKDIR))
+
+ // Shortest possible
+ c.Set(CONF_WORKDIR, "~/")
+ expandTilde(c)
+ assert.Equal(t, userHome(), c.Get(CONF_WORKDIR))
+
+ // Single character workdir with only a tilde
+ c.Set(CONF_WORKDIR, "~")
+ expandTilde(c)
+ assert.Equal(t, userHome(), c.Get(CONF_WORKDIR))
+
+ // Ignored tilde
+ c.Set(CONF_WORKDIR, "~test")
+ expandTilde(c)
+ assert.Equal(t, "~test", c.Get(CONF_WORKDIR))
+} \ No newline at end of file