mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 07:18:54 +00:00
testing: Simplify line ending handling in tests
This commit is contained in:
@@ -87,18 +87,6 @@ var commonTestScriptsParam = testscript.Params{
|
||||
"log": func(ts *testscript.TestScript, neg bool, args []string) {
|
||||
log.Println(args)
|
||||
},
|
||||
// dostounix converts \r\n to \n.
|
||||
"dostounix": func(ts *testscript.TestScript, neg bool, args []string) {
|
||||
filename := ts.MkAbs(args[0])
|
||||
b, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
ts.Fatalf("%v", err)
|
||||
}
|
||||
b = bytes.Replace(b, []byte("\r\n"), []byte{'\n'}, -1)
|
||||
if err := os.WriteFile(filename, b, 0o666); err != nil {
|
||||
ts.Fatalf("%v", err)
|
||||
}
|
||||
},
|
||||
// cat prints a file to stdout.
|
||||
"cat": func(ts *testscript.TestScript, neg bool, args []string) {
|
||||
filename := ts.MkAbs(args[0])
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
@@ -1,8 +1,5 @@
|
||||
# Test the hugo mod commands.
|
||||
|
||||
dostounix golden/vendor.txt
|
||||
dostounix golden/go.mod.testsubmod
|
||||
|
||||
hugo mod graph
|
||||
stdout 'empty-hugo'
|
||||
hugo mod verify
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Test the hugo init command.
|
||||
dostounix golden/go.mod.testsubmod
|
||||
|
||||
hugo mod init testsubmod
|
||||
cmpenv go.mod $WORK/golden/go.mod.testsubmod
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
# Test mod npm pack.
|
||||
|
||||
dostounix golden1/package.json
|
||||
dostounix golden1/packages/hugoautogen/package.json
|
||||
dostounix golden1/packages/hugoautogen/hugo_packagemeta.json
|
||||
dostounix golden2/packages/hugoautogen/package.json
|
||||
dostounix golden3/packages/hugoautogen/package.json
|
||||
dostounix golden4/packages/hugoautogen/package.json
|
||||
dostounix golden5/packages/hugoautogen/package.json
|
||||
|
||||
hugo mod npm pack
|
||||
cmp packages/hugoautogen/package.json golden1/packages/hugoautogen/package.json
|
||||
cmp package.json golden1/package.json
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
# Test mod npm pack with shuffled modules.
|
||||
|
||||
dostounix golden1/package.json
|
||||
dostounix golden1/packages/hugoautogen/package.json
|
||||
dostounix golden1/packages/hugoautogen/hugo_packagemeta.json
|
||||
|
||||
hugo mod npm pack
|
||||
cmp packages/hugoautogen/package.json golden1/packages/hugoautogen/package.json
|
||||
cmp package.json golden1/package.json
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
# See https://github.com/gohugoio/hugo/issues/13465
|
||||
[windows] skip
|
||||
|
||||
dostounix golden/packages/hugoautogen/package.json
|
||||
dostounix golden/package.json
|
||||
|
||||
hugo mod npm pack
|
||||
cmp packages/hugoautogen/package.json golden/packages/hugoautogen/package.json
|
||||
cmp package.json golden/package.json
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# Test hugo mod tidy.
|
||||
|
||||
dostounix golden/go.mod.cleaned
|
||||
|
||||
hugo mod tidy
|
||||
|
||||
cmp go.mod golden/go.mod.cleaned
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
dostounix golden/vendor.txt
|
||||
|
||||
hugo mod vendor
|
||||
cmp _vendor/modules.txt golden/vendor.txt
|
||||
ls _vendor/github.com/gohugoio/hugo-mod-integrationtests/withconfigtoml
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
dostounix golden/vendor.txt
|
||||
|
||||
hugo mod vendor
|
||||
cmp _vendor/modules.txt golden/vendor.txt
|
||||
lsr _vendor
|
||||
|
||||
Reference in New Issue
Block a user