]> Sergey Matveev's repositories - path-extractor.git/blobdiff - pe_test.go
Reformat readme
[path-extractor.git] / pe_test.go
index 18297677e2aca6a578eacfcc967ae18fcc148add..bc07d279b695c12fb8f8c33e1cd2cc7f6efde3be 100644 (file)
@@ -8,6 +8,26 @@ func TestEverything(t *testing.T) {
                t.Errorf("Doesnt match files", output)
        }
 
+       output = GetAllMatches("2.0G", "")
+       if len(output) != 0 {
+               t.Errorf("File size matches", output)
+       }
+
+       output = GetAllMatches("4.0K", "")
+       if len(output) != 0 {
+               t.Errorf("File size matches", output)
+       }
+
+       output = GetAllMatches("72K", "")
+       if len(output) != 0 {
+               t.Errorf("File size matches", output)
+       }
+
+       output = GetAllMatches("remotes/origin/master", "")
+       if len(output) != 0 {
+               t.Errorf("Git branch matches", output)
+       }
+
        output = GetAllMatches("I have a cat.", "")
        if len(output) != 0 {
                t.Errorf("Matches sentence", output)
@@ -112,6 +132,11 @@ func TestEverything(t *testing.T) {
                t.Errorf("Matches version number", output)
        }
 
+       output = GetAllMatches("14.22.2", "")
+       if len(output) != 0 {
+               t.Errorf("Matches version number", output)
+       }
+
        output = GetAllMatches("~/v1.2/js", "")
        if len(output) != 1 {
                t.Errorf("Should match path with version inside", output)
@@ -157,6 +182,16 @@ func TestEverything(t *testing.T) {
                t.Errorf("Doesnt match multiple extensions", output)
        }
 
+       output = GetAllMatches("[Error/foobar]", "")
+       if len(output) == 1 {
+               t.Errorf("Matches error", output)
+       }
+
+       output = GetAllMatches("[Object.foo]", "")
+       if len(output) == 1 {
+               t.Errorf("Matches Object.foo", output)
+       }
+
        output = GetAllMatches("(user.js)", "")
        if len(output) != 1 {
                t.Errorf("Doesnt match surrounded by parens", output)
@@ -198,4 +233,16 @@ func TestEverything(t *testing.T) {
        if output[0] != "test.js:45:12" {
                t.Errorf("Ackmate should output right line number", output)
        }
+
+       output = GetAllMatches("test.js:45:12 foo bar", "ackmate")
+       if len(output) != 1 {
+               t.Errorf("Ackmate doesnt match", output)
+       }
+
+       if output[0] == "test.js" {
+               t.Errorf("Ackmate should not forget number", output)
+       }
+       if output[0] != "test.js:45:12" {
+               t.Errorf("Ackmate should output right line number", output)
+       }
 }