Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9e03fcfb2f |
@@ -777,9 +777,8 @@ func TestGenerateLeavesOutputOutOfListing(t *testing.T) {
|
|||||||
|
|
||||||
fs := afero.NewOsFs()
|
fs := afero.NewOsFs()
|
||||||
require.NoError(t, fs.MkdirAll(filepath.Join(tree, "sub"), 0o750))
|
require.NoError(t, fs.MkdirAll(filepath.Join(tree, "sub"), 0o750))
|
||||||
require.NoError(t,
|
require.NoError(t, os.Symlink(filepath.Join(root, "data"), filepath.Join(root, "link")))
|
||||||
os.Symlink(filepath.Join(root, "data"), filepath.Join(root, "link")))
|
writeTestFile(t, fs, filepath.Join(tree, "readme.txt"), "hello")
|
||||||
writeTestFile(t, fs, filepath.Join(tree, testFileTxt), "hello")
|
|
||||||
writeTestFile(t, fs, filepath.Join(tree, "sub", "index.mf"), "an ordinary file")
|
writeTestFile(t, fs, filepath.Join(tree, "sub", "index.mf"), "an ordinary file")
|
||||||
writeTestFile(t, fs, output, "previous manifest")
|
writeTestFile(t, fs, output, "previous manifest")
|
||||||
|
|
||||||
@@ -788,7 +787,7 @@ func TestGenerateLeavesOutputOutOfListing(t *testing.T) {
|
|||||||
}, fs)
|
}, fs)
|
||||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||||
|
|
||||||
assert.ElementsMatch(t, []string{testFileTxt, "sub/index.mf"},
|
assert.ElementsMatch(t, []string{"readme.txt", "sub/index.mf"},
|
||||||
manifestPaths(t, fs, output))
|
manifestPaths(t, fs, output))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -803,13 +802,13 @@ func TestGenerateDefaultOutputLeftOutOfListing(t *testing.T) {
|
|||||||
chdirTemp(t)
|
chdirTemp(t)
|
||||||
|
|
||||||
fs := afero.NewOsFs()
|
fs := afero.NewOsFs()
|
||||||
writeTestFile(t, fs, testFileTxt, "hello")
|
writeTestFile(t, fs, "readme.txt", "hello")
|
||||||
writeTestFile(t, fs, "index.mf", "previous manifest")
|
writeTestFile(t, fs, "index.mf", "previous manifest")
|
||||||
|
|
||||||
opts := testOpts([]string{testApp, cmdGenerate, "-q", "--force"}, fs)
|
opts := testOpts([]string{testApp, cmdGenerate, "-q", "--force"}, fs)
|
||||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||||
|
|
||||||
assert.Equal(t, []string{testFileTxt}, manifestPaths(t, fs, "index.mf"))
|
assert.Equal(t, []string{"readme.txt"}, manifestPaths(t, fs, "index.mf"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestGenerateAtomicWriteUsesTemp(t *testing.T) {
|
func TestGenerateAtomicWriteUsesTemp(t *testing.T) {
|
||||||
|
|||||||
@@ -108,21 +108,19 @@ func TestFreshenLeavesManifestOutOfListing(t *testing.T) {
|
|||||||
|
|
||||||
fs := afero.NewOsFs()
|
fs := afero.NewOsFs()
|
||||||
require.NoError(t, fs.MkdirAll(filepath.Join(root, "sub"), 0o750))
|
require.NoError(t, fs.MkdirAll(filepath.Join(root, "sub"), 0o750))
|
||||||
writeTestFile(t, fs, filepath.Join(root, testFileTxt), "hello")
|
writeTestFile(t, fs, filepath.Join(root, "readme.txt"), "hello")
|
||||||
writeTestFile(t, fs, filepath.Join(root, "listing.mf"), "an ordinary file")
|
writeTestFile(t, fs, filepath.Join(root, "listing.mf"), "an ordinary file")
|
||||||
|
|
||||||
opts := testOpts([]string{testApp, cmdGenerate, "-q", "-o", manifestPath, root}, fs)
|
opts := testOpts([]string{testApp, cmdGenerate, "-q", "-o", manifestPath, root}, fs)
|
||||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||||
|
|
||||||
// A new file gives freshen something to write.
|
// A new file gives freshen something to write.
|
||||||
writeTestFile(t, fs, filepath.Join(root, "added.txt"), "added")
|
writeTestFile(t, fs, filepath.Join(root, "new.txt"), "new")
|
||||||
|
|
||||||
opts = testOpts([]string{
|
opts = testOpts([]string{testApp, "freshen", "-q", testFlagBase, root, manifestPath}, fs)
|
||||||
testApp, "freshen", "-q", testFlagBase, root, manifestPath,
|
|
||||||
}, fs)
|
|
||||||
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
require.Equal(t, 0, runCLI(opts), "stderr: %s", testStderr(t, opts))
|
||||||
|
|
||||||
assert.ElementsMatch(t, []string{testFileTxt, "listing.mf", "added.txt"},
|
assert.ElementsMatch(t, []string{"readme.txt", "listing.mf", "new.txt"},
|
||||||
manifestPaths(t, fs, manifestPath))
|
manifestPaths(t, fs, manifestPath))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user