aboutsummaryrefslogtreecommitdiff
path: root/watcher_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-08-01 20:31:25 +0700
committerShulhan <ms@kilabit.info>2022-08-01 20:39:38 +0700
commitf0be5f35c325da2aebea6e0d98f035ad23dc3019 (patch)
tree270513ab0d9872a9b30b799ad084a181378fbad1 /watcher_test.go
parent0a9e6c793dc1d91d71db6838e2c45adecc6aae92 (diff)
downloadciigo-f0be5f35c325da2aebea6e0d98f035ad23dc3019.tar.xz
all: clean up codes
Replace any usage of ":=" with explicit variable declaration for better types clarity.
Diffstat (limited to 'watcher_test.go')
-rw-r--r--watcher_test.go24
1 files changed, 17 insertions, 7 deletions
diff --git a/watcher_test.go b/watcher_test.go
index a2e7f43..0e082f2 100644
--- a/watcher_test.go
+++ b/watcher_test.go
@@ -71,7 +71,9 @@ func TestWatcher(t *testing.T) {
func testCreate(t *testing.T) {
var (
+ got *fileMarkup
err error
+ expBody string
gotBody []byte
)
@@ -81,11 +83,11 @@ func testCreate(t *testing.T) {
t.Fatal(err)
}
- got := waitChanges()
+ got = waitChanges()
test.Assert(t, "New adoc file created", testFileAdoc, got.path)
- expBody := `<!DOCTYPE>
+ expBody = `<!DOCTYPE>
<html>
<head><title></title></head>
<body>
@@ -112,7 +114,9 @@ func testCreate(t *testing.T) {
func testUpdate(t *testing.T) {
var (
err error
+ expBody string
gotBody []byte
+ got *fileMarkup
)
_, err = testAdocFile.WriteString("= Hello")
@@ -124,10 +128,10 @@ func testUpdate(t *testing.T) {
t.Fatal(err)
}
- got := waitChanges()
+ got = waitChanges()
test.Assert(t, "adoc file updated", testFileAdoc, got.path)
- expBody := `<!DOCTYPE>
+ expBody = `<!DOCTYPE>
<html>
<head><title>Hello</title></head>
<body>
@@ -154,7 +158,13 @@ func testUpdate(t *testing.T) {
}
func testDelete(t *testing.T) {
- err := testAdocFile.Close()
+ var (
+ err error
+ got *fileMarkup
+ gotIsExist bool
+ )
+
+ err = testAdocFile.Close()
if err != nil {
t.Fatal(err)
}
@@ -164,10 +174,10 @@ func testDelete(t *testing.T) {
t.Fatal(err)
}
- got := waitChanges()
+ got = waitChanges()
test.Assert(t, "adoc file updated", testFileAdoc, got.path)
- _, gotIsExist := testWatcher.fileMarkups[testFileAdoc]
+ _, gotIsExist = testWatcher.fileMarkups[testFileAdoc]
test.Assert(t, "adoc file deleted", false, gotIsExist)
}