Skip to content

Commit

Permalink
Add tests for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
avindra committed Jan 20, 2021
1 parent b49787b commit 93a4f18
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,32 @@ Downloads|/home/dolores/Downloads
t.Error("Corrupted parse")
}
}

func TestConfigComments(t *testing.T) {
cfg := ReadConfig(strings.NewReader(`
rootfs|/
sys library|/Library
#temp fs|/tmp
`))

if len(cfg) > 2 {
t.Error("Too many entries")
}
}

// commented lines MUST begin with a #
func TestConfigCommentLimitation(t *testing.T) {
cfg := ReadConfig(strings.NewReader(`
rootfs|/
sys library|/Library
#temp fs|/tmp
`))

if len(cfg) != 3 {
t.Error("Too many entries")
}

if cfg[" #temp fs"] != "/tmp" {
t.Error("Boo")
}
}

0 comments on commit 93a4f18

Please sign in to comment.