diff options
| author | Kaushal Subedi | 2015-10-25 15:09:57 -0600 | 
|---|---|---|
| committer | Kaushal Subedi | 2015-10-25 15:09:57 -0600 | 
| commit | 3c26cf9dc98484a7b519db60a9a34e9969868d03 (patch) | |
| tree | ffddf977e08c609bb42342a53c872e30b8510623 /main_test.go | |
| download | gomove-3c26cf9dc98484a7b519db60a9a34e9969868d03.tar.bz2 | |
initial commit
Diffstat (limited to 'main_test.go')
| -rw-r--r-- | main_test.go | 26 | 
1 files changed, 26 insertions, 0 deletions
| diff --git a/main_test.go b/main_test.go new file mode 100644 index 0000000..b0ede2f --- /dev/null +++ b/main_test.go @@ -0,0 +1,26 @@ +package main + +import ( +	"io/ioutil" +	"os" +	"strings" +	"testing" +) + +func TestApp(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") + +	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") +} | 
