"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "hugolib/resource_chain_test.go" between
hugo-0.80.0.tar.gz and hugo-0.81.0.tar.gz

About: Hugo is a static site generator that takes a source directory of Markdown files and templates and uses these as input to create a complete website (written in Go).

resource_chain_test.go  (hugo-0.80.0):resource_chain_test.go  (hugo-0.81.0)
skipping to change at line 26 skipping to change at line 26
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"io" "io"
"math/rand" "math/rand"
"os" "os"
"github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass"
"path/filepath" "path/filepath"
"runtime"
"strings" "strings"
"testing" "testing"
"time" "time"
"github.com/gohugoio/hugo/common/hexec" "github.com/gohugoio/hugo/common/hexec"
jww "github.com/spf13/jwalterweatherman" jww "github.com/spf13/jwalterweatherman"
"github.com/gohugoio/hugo/common/herrors" "github.com/gohugoio/hugo/common/herrors"
skipping to change at line 575 skipping to change at line 574
Min JS: {{ ( resources.Get "js/script1.js" | resources.Minify ).Content | safeJS }} Min JS: {{ ( resources.Get "js/script1.js" | resources.Minify ).Content | safeJS }}
Min JSON: {{ ( resources.Get "mydata/json1.json" | resources.Minify ).Content | safeHTML }} Min JSON: {{ ( resources.Get "mydata/json1.json" | resources.Minify ).Content | safeHTML }}
Min XML: {{ ( resources.Get "mydata/xml1.xml" | resources.Minify ).Content | saf eHTML }} Min XML: {{ ( resources.Get "mydata/xml1.xml" | resources.Minify ).Content | saf eHTML }}
Min SVG: {{ ( resources.Get "mydata/svg1.svg" | resources.Minify ).Content | saf eHTML }} Min SVG: {{ ( resources.Get "mydata/svg1.svg" | resources.Minify ).Content | saf eHTML }}
Min SVG again: {{ ( resources.Get "mydata/svg1.svg" | resources.Minify ).Content | safeHTML }} Min SVG again: {{ ( resources.Get "mydata/svg1.svg" | resources.Minify ).Content | safeHTML }}
Min HTML: {{ ( resources.Get "mydata/html1.html" | resources.Minify ).Content | safeHTML }} Min HTML: {{ ( resources.Get "mydata/html1.html" | resources.Minify ).Content | safeHTML }}
`) `)
}, func(b *sitesBuilder) { }, func(b *sitesBuilder) {
b.AssertFileContent("public/index.html", `Min CSS: h1{fon t-style:bold}`) b.AssertFileContent("public/index.html", `Min CSS: h1{fon t-style:bold}`)
b.AssertFileContent("public/index.html", `Min JS: var x;x =5;document.getElementById("demo").innerHTML=x*10;`) b.AssertFileContent("public/index.html", `Min JS: var x;x =5,document.getElementById("demo").innerHTML=x*10`)
b.AssertFileContent("public/index.html", `Min JSON: {"emp loyees":[{"firstName":"John","lastName":"Doe"},{"firstName":"Anna","lastName":"S mith"},{"firstName":"Peter","lastName":"Jones"}]}`) b.AssertFileContent("public/index.html", `Min JSON: {"emp loyees":[{"firstName":"John","lastName":"Doe"},{"firstName":"Anna","lastName":"S mith"},{"firstName":"Peter","lastName":"Jones"}]}`)
b.AssertFileContent("public/index.html", `Min XML: <hello ><world>Hugo Rocks!</<world></hello>`) b.AssertFileContent("public/index.html", `Min XML: <hello ><world>Hugo Rocks!</<world></hello>`)
b.AssertFileContent("public/index.html", `Min SVG: <svg h eight="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`) b.AssertFileContent("public/index.html", `Min SVG: <svg h eight="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`)
b.AssertFileContent("public/index.html", `Min SVG again: <svg height="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`) b.AssertFileContent("public/index.html", `Min SVG again: <svg height="100" width="100"><path d="M1e2 1e2H3e2 2e2z"/></svg>`)
b.AssertFileContent("public/index.html", `Min HTML: <html ><a href=#>Cool</a></html>`) b.AssertFileContent("public/index.html", `Min HTML: <html ><a href=#>Cool</a></html>`)
}}, }},
{"concat", func() bool { return true }, func(b *sitesBuilder) { {"concat", func() bool { return true }, func(b *sitesBuilder) {
b.WithTemplates("home.html", ` b.WithTemplates("home.html", `
{{ $a := "A" | resources.FromString "a.txt"}} {{ $a := "A" | resources.FromString "a.txt"}}
skipping to change at line 923 skipping to change at line 922
Hello1: Bonjour Hello1: Bonjour
Hello2: Bonjour Hello2: Bonjour
`) `)
} }
func TestResourceChainPostCSS(t *testing.T) { func TestResourceChainPostCSS(t *testing.T) {
if !htesting.IsCI() { if !htesting.IsCI() {
t.Skip("skip (relative) long running modules test when running lo cally") t.Skip("skip (relative) long running modules test when running lo cally")
} }
if runtime.GOOS == "windows" {
t.Skip("skip npm test on Windows")
}
wd, _ := os.Getwd() wd, _ := os.Getwd()
defer func() { defer func() {
os.Chdir(wd) os.Chdir(wd)
}() }()
c := qt.New(t) c := qt.New(t)
packageJSON := `{ packageJSON := `{
"scripts": {}, "scripts": {},
skipping to change at line 1031 skipping to change at line 1026
b.WithSourceFile("postcss.config.js", postcssConfig) b.WithSourceFile("postcss.config.js", postcssConfig)
b.Assert(os.Chdir(workDir), qt.IsNil) b.Assert(os.Chdir(workDir), qt.IsNil)
cmd, err := hexec.SafeCommand("npm", "install") cmd, err := hexec.SafeCommand("npm", "install")
_, err = cmd.CombinedOutput() _, err = cmd.CombinedOutput()
b.Assert(err, qt.IsNil) b.Assert(err, qt.IsNil)
b.Build(BuildCfg{}) b.Build(BuildCfg{})
// Make sure Node sees this. // Make sure Node sees this.
b.Assert(logBuf.String(), qt.Contains, "Hugo Environment: production") b.Assert(logBuf.String(), qt.Contains, "Hugo Environment: production")
b.Assert(logBuf.String(), qt.Contains, fmt.Sprintf("PostCSS Config File: b.Assert(logBuf.String(), qt.Contains, filepath.FromSlash(fmt.Sprintf("Po
%s/postcss.config.js", workDir)) stCSS Config File: %s/postcss.config.js", workDir)))
b.Assert(logBuf.String(), qt.Contains, fmt.Sprintf("package.json: %s/pack b.Assert(logBuf.String(), qt.Contains, filepath.FromSlash(fmt.Sprintf("pa
age.json", workDir)) ckage.json: %s/package.json", workDir)))
b.AssertFileContent("public/index.html", ` b.AssertFileContent("public/index.html", `
Styles RelPermalink: /css/styles.css Styles RelPermalink: /css/styles.css
Styles Content: Len: 770878| Styles Content: Len: 770878|
`) `)
assertCss := func(b *sitesBuilder) { assertCss := func(b *sitesBuilder) {
content := b.FileContent("public/css/styles.css") content := b.FileContent("public/css/styles.css")
b.Assert(strings.Contains(content, "class-in-a"), qt.Equals, true ) b.Assert(strings.Contains(content, "class-in-a"), qt.Equals, true )
 End of changes. 4 change blocks. 
10 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)