Skip to content

Commit

Permalink
Reformat test
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jan 5, 2019
1 parent 7bb40c2 commit ba1c8fa
Showing 1 changed file with 40 additions and 19 deletions.
59 changes: 40 additions & 19 deletions lib/chezmoi/target_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,24 @@ func TestEndToEnd(t *testing.T) {
{
name: "all",
root: map[string]interface{}{
"/home/user/.bashrc": "foo",
"/home/user/dir": map[string]interface{}{
"foo": "foo",
"bar": "bar",
"/home/user": map[string]interface{}{
".bashrc": "foo",
"dir": map[string]interface{}{
"foo": "foo",
"bar": "bar",
},
"replace_symlink": &vfst.Symlink{Target: "foo"},
},
"/home/user/.chezmoi": map[string]interface{}{
"dot_bashrc": "bar",
".git/HEAD": "HEAD",
"dot_hgrc.tmpl": "[ui]\nusername = {{ .name }} <{{ .email }}>\n",
"empty.tmpl": "{{ if false }}foo{{ end }}",
"empty_foo": "",
"exact_dir/foo": "foo",
"symlink_bar": "empty",
"symlink_replace_symlink": "bar",
},
"/home/user/replace_symlink": &vfst.Symlink{Target: "foo"},
"/home/user/.chezmoi/dot_bashrc": "bar",
"/home/user/.chezmoi/.git/HEAD": "HEAD",
"/home/user/.chezmoi/dot_hgrc.tmpl": "[ui]\nusername = {{ .name }} <{{ .email }}>\n",
"/home/user/.chezmoi/empty.tmpl": "{{ if false }}foo{{ end }}",
"/home/user/.chezmoi/empty_foo": "",
"/home/user/.chezmoi/exact_dir/foo": "foo",
"/home/user/.chezmoi/symlink_bar": "empty",
"/home/user/.chezmoi/symlink_replace_symlink": "bar",
},
sourceDir: "/home/user/.chezmoi",
data: map[string]interface{}{
Expand All @@ -311,12 +315,29 @@ func TestEndToEnd(t *testing.T) {
targetDir: "/home/user",
umask: 022,
tests: []vfst.Test{
vfst.TestPath("/home/user/.bashrc", vfst.TestModeIsRegular, vfst.TestContentsString("bar")),
vfst.TestPath("/home/user/.hgrc", vfst.TestModeIsRegular, vfst.TestContentsString("[ui]\nusername = John Smith <hello@example.com>\n")),
vfst.TestPath("/home/user/foo", vfst.TestModeIsRegular, vfst.TestContents(nil)),
vfst.TestPath("/home/user/bar", vfst.TestModeType(os.ModeSymlink), vfst.TestSymlinkTarget("empty")),
vfst.TestPath("/home/user/replace_symlink", vfst.TestModeType(os.ModeSymlink), vfst.TestSymlinkTarget("bar")),
vfst.TestPath("/home/user/dir/bar", vfst.TestDoesNotExist),
vfst.TestPath("/home/user/.bashrc",
vfst.TestModeIsRegular,
vfst.TestContentsString("bar"),
),
vfst.TestPath("/home/user/.hgrc",
vfst.TestModeIsRegular,
vfst.TestContentsString("[ui]\nusername = John Smith <hello@example.com>\n"),
),
vfst.TestPath("/home/user/foo",
vfst.TestModeIsRegular,
vfst.TestContents(nil),
),
vfst.TestPath("/home/user/bar",
vfst.TestModeType(os.ModeSymlink),
vfst.TestSymlinkTarget("empty"),
),
vfst.TestPath("/home/user/replace_symlink",
vfst.TestModeType(os.ModeSymlink),
vfst.TestSymlinkTarget("bar"),
),
vfst.TestPath("/home/user/dir/bar",
vfst.TestDoesNotExist,
),
},
},
} {
Expand Down

0 comments on commit ba1c8fa

Please sign in to comment.