]> Sergey Matveev's repositories - path-extractor.git/commitdiff
Move cli entry poiny to path-extractor/
authorEdgar HIPP <hipp.edg@gmail.com>
Thu, 9 Jul 2015 20:32:43 +0000 (22:32 +0200)
committerEdgar HIPP <hipp.edg@gmail.com>
Thu, 9 Jul 2015 20:32:43 +0000 (22:32 +0200)
extractor.go
path-extractor/pe.go [moved from pe.go with 69% similarity]
pe_test.go
validators.go

index b7be986ea6b3ab8bca8582b0c8d6af4c7bb06d8e..0b036640ede67bd1bedea8b92f21d1cdf47e96f8 100644 (file)
@@ -1,4 +1,4 @@
-package main
+package pathextractor
 
 import "regexp"
 
@@ -10,7 +10,7 @@ func pathExtractor(input string) [][][]byte {
        return temp
 }
 
-func getAllMatches(input string) []string {
+func GetAllMatches(input string) []string {
        matches := [][][]byte{}
        result := []string{}
        s := string("")
similarity index 69%
rename from pe.go
rename to path-extractor/pe.go
index 5147f27862ae95d3ddc4a790f6cee77a636bdd89..d95d456d1478a4326ab44b8b032150f195819380 100644 (file)
--- a/pe.go
@@ -1,5 +1,7 @@
 package main
 
+import "github.com/edi9999/path-extractor"
+
 import (
        "bufio"
        "fmt"
@@ -10,7 +12,7 @@ func main() {
        stdin := os.Stdin
        if scanner := bufio.NewScanner(stdin); scanner != nil {
                for scanner.Scan() {
-                       matches := getAllMatches(scanner.Text())
+                       matches := pathextractor.GetAllMatches(scanner.Text())
                        for _, match := range matches {
                                fmt.Println(match)
                        }
index 2ef95b285870f1d42b9dda338da17f079fc0f9a3..6545029a9c379c20334858f8ae1dafb506c23793 100644 (file)
@@ -1,64 +1,64 @@
-package main
+package pathextractor
 
 import "testing"
 
 func TestGitIgnore(t *testing.T) {
-       output := getAllMatches("?? alt/generateStore.php")
+       output := GetAllMatches("?? alt/generateStore.php")
        if output[0] != "alt/generateStore.php" {
                t.Errorf("Doesnt match files", output[0])
        }
 
-       output = getAllMatches("hello .gitignore")
+       output = GetAllMatches("hello .gitignore")
        if output[0] != ".gitignore" {
                t.Errorf("Doesnt match hidden files", output[0])
        }
 
-       output = getAllMatches(" mail@mail.com ")
+       output = GetAllMatches(" mail@mail.com ")
        if len(output) != 0 {
                t.Errorf("Matches email adresses", output[0])
        }
 
-       output = getAllMatches("v1.2")
+       output = GetAllMatches("v1.2")
        if len(output) != 0 {
                t.Errorf("Matches version number", output[0])
        }
 
-       output = getAllMatches("obj.slice()")
+       output = GetAllMatches("obj.slice()")
        if len(output) != 0 {
                t.Errorf("Matches function call", output[0])
        }
 
-       output = getAllMatches("~/www")
+       output = GetAllMatches("~/www")
        if len(output) == 0 || output[0] != "~/www" {
                t.Errorf("Doesnt match home", output[0])
        }
 
-       output = getAllMatches("origin/master")
+       output = GetAllMatches("origin/master")
        if len(output) != 0 {
                t.Errorf("Matches remote name", output[0])
        }
 
-       output = getAllMatches("john doe (dead on 28/04/2014)")
+       output = GetAllMatches("john doe (dead on 28/04/2014)")
        if len(output) != 0 {
                t.Errorf("Matches date", output[0])
        }
 
-       output = getAllMatches("john doe ,dead on 28/04/2014")
+       output = GetAllMatches("john doe ,dead on 28/04/2014")
        if len(output) != 0 {
                t.Errorf("Matches date", output[0])
        }
 
-       output = getAllMatches(".gitignore , ~/www")
+       output = GetAllMatches(".gitignore , ~/www")
        if len(output) != 2 {
                t.Errorf("Doesnt match multi", output[0])
        }
 
-       output = getAllMatches("var/")
+       output = GetAllMatches("var/")
        if len(output) != 1 {
                t.Errorf("Doesnt match dir", output[0])
        }
 
-       output = getAllMatches("//")
+       output = GetAllMatches("//")
        if len(output) != 0 {
                t.Errorf("Comment matches", output[0])
        }
index 74b774603977ad21fdf5ef8e1fef0270cfb0fe16..cd9477dc64acd28b5cfde017ecb25ef3ec6af713 100644 (file)
@@ -1,4 +1,4 @@
-package main
+package pathextractor
 
 import (
        "regexp"