summaryrefslogtreecommitdiff
path: root/cmds/cmds_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/cmds_test.go')
-rw-r--r--cmds/cmds_test.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/cmds/cmds_test.go b/cmds/cmds_test.go
deleted file mode 100644
index 33d6281..0000000
--- a/cmds/cmds_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package cmds
-
-import (
- "os"
- "testing"
-)
-
-func TestCd(t *testing.T) {
- Eval("cd /tmp")
- d, _ := os.Getwd()
-
- if d != "/tmp" {
- t.Errorf("Expected %q, got %q\n", "/tmp", d)
- }
-}
-
-func TestCdFail(t *testing.T) {
- c, _ := os.Getwd()
- err := Eval("cd /root")
- t.Logf("%v\n", err)
-
- d, _ := os.Getwd()
- if c != d || err == nil {
- t.Errorf("Expected %q, got %q\n", c, d)
- }
-}
-
-func TestExport(t *testing.T) {
- err := Eval("export TEST=true")
- test := os.Getenv("TEST")
-
- if err != nil {
- t.Errorf("%v\n", err)
- }
- if test != "true" {
- t.Errorf("Expected %q, got %q\n", "true", test)
- }
-}
-
-func TestExportFail(t *testing.T) {
- err := Eval("export TEST = 123")
- if err == nil {
- t.Errorf("Didn't get error\n")
- }
- t.Logf("%v\n", err)
-}
-
-func TestUnset(t *testing.T) {
- err := Eval("unset TEST")
- test := os.Getenv("TEST")
-
- if err != nil {
- t.Logf("%v\n", err)
- }
- if test != "" {
- t.Errorf("Expected empty string, got %q\n", test)
- }
-}
-
-func TestExitFail(t *testing.T) {
- err := Eval("exit abc")
-
- if err == nil {
- t.Errorf("Didn't get error\n")
- }
- t.Logf("%v\n", err)
-}