]> git.lizzy.rs Git - micro.git/blobdiff - cmd/micro/util_test.go
Code optimisation (#1117)
[micro.git] / cmd / micro / util_test.go
index 0104218eb90b555cffb77dde751cf3a876dea81f..51a24e024e79d93c7a63e537799f3ec7bc13fc66 100644 (file)
@@ -1,7 +1,6 @@
 package main
 
 import (
-       "reflect"
        "testing"
 )
 
@@ -67,56 +66,6 @@ func TestIsWordChar(t *testing.T) {
        }
 }
 
-func TestJoinAndSplitCommandArgs(t *testing.T) {
-       tests := []struct {
-               Query  []string
-               Wanted string
-       }{
-               {[]string{`test case`}, `"test case"`},
-               {[]string{`quote "test"`}, `"quote \"test\""`},
-               {[]string{`slash\\\ test`}, `"slash\\\\\\ test"`},
-               {[]string{`path 1`, `path\" 2`}, `"path 1" "path\\\" 2"`},
-               {[]string{`foo`}, `foo`},
-               {[]string{`foo\"bar`}, `"foo\\\"bar"`},
-               {[]string{``}, ``},
-               {[]string{`"`}, `"\""`},
-               {[]string{`a`, ``}, `a `},
-               {[]string{``, ``, ``, ``}, `   `},
-               {[]string{"\n"}, `"\n"`},
-               {[]string{"foo\tbar"}, `"foo\tbar"`},
-       }
-
-       for i, test := range tests {
-               if result := JoinCommandArgs(test.Query...); test.Wanted != result {
-                       t.Errorf("JoinCommandArgs failed at Test %d\nGot: %q", i, result)
-               }
-
-               if result := SplitCommandArgs(test.Wanted); !reflect.DeepEqual(test.Query, result) {
-                       t.Errorf("SplitCommandArgs failed at Test %d\nGot: `%q`", i, result)
-               }
-       }
-
-       splitTests := []struct {
-               Query  string
-               Wanted []string
-       }{
-               {`"hallo""Welt"`, []string{`halloWelt`}},
-               {`"hallo" "Welt"`, []string{`hallo`, `Welt`}},
-               {`\"`, []string{`\"`}},
-               {`"foo`, []string{`"foo`}},
-               {`"foo"`, []string{`foo`}},
-               {`"\"`, []string{`"\"`}},
-               {`"C:\\"foo.txt`, []string{`C:\foo.txt`}},
-               {`"\n"new"\n"line`, []string{"\nnew\nline"}},
-       }
-
-       for i, test := range splitTests {
-               if result := SplitCommandArgs(test.Query); !reflect.DeepEqual(test.Wanted, result) {
-                       t.Errorf("SplitCommandArgs failed at Split-Test %d\nGot: `%q`", i, result)
-               }
-       }
-}
-
 func TestStringWidth(t *testing.T) {
        tabsize := 4
        if w := StringWidth("1\t2", tabsize); w != 5 {