aboutsummaryrefslogtreecommitdiffstats
path: root/main_test.go
diff options
context:
space:
mode:
authorKaushal Subedi2015-10-26 20:43:54 -0600
committerKaushal Subedi2015-10-26 20:43:54 -0600
commitf5f1e23dba10c1a2dc3d90afb2c8d0dec70b2ebc (patch)
treea6fed366913dbd2b94149f121ddd339c7a69f1e2 /main_test.go
parentd40ae98795e704d5931ae2d0124181ce72fab922 (diff)
downloadgomove-f5f1e23dba10c1a2dc3d90afb2c8d0dec70b2ebc.tar.bz2
added processing of go files without using ast
Diffstat (limited to 'main_test.go')
-rw-r--r--main_test.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/main_test.go b/main_test.go
index b0ede2f..17a8219 100644
--- a/main_test.go
+++ b/main_test.go
@@ -7,12 +7,30 @@ import (
"testing"
)
-func TestApp(t *testing.T) {
+func TestAppAST(t *testing.T) {
fileContent := "package testing\n\nimport \"fmt\"\n\nfunc HelloWorld() {\nfmt.Println(\"Hello World!\")\n}\n"
ioutil.WriteFile("hello.go", []byte(fileContent), os.ModePerm)
- ProcessFile("hello.go", "fmt", "replacedImport")
+ ProcessFileAST("hello.go", "fmt", "replacedImport")
+
+ result, err := ioutil.ReadFile("hello.go")
+ if err != nil {
+ t.Error("Failed to read written file.")
+ }
+
+ if !strings.Contains(string(result), "replacedImport") {
+ t.Error("Got different results")
+ }
+ os.Remove("hello.go")
+}
+
+func TestAppNative(t *testing.T) {
+ fileContent := "package testing\n\nimport \"fmt\"\n\nfunc HelloWorld() {\nfmt.Println(\"Hello World!\")\n}\n"
+
+ ioutil.WriteFile("hello.go", []byte(fileContent), os.ModePerm)
+
+ ProcessFileNative("hello.go", "fmt", "replacedImport")
result, err := ioutil.ReadFile("hello.go")
if err != nil {