@@ -125,12 +125,7 @@ weight = 1
125125[languages.sv]
126126weight = 2
127127`
128- b , err := NewIntegrationTestBuilder (
129- IntegrationTestConfig {
130- T : t ,
131- TxtarString : files ,
132- },
133- ).BuildE ()
128+ b , err := TestE (t , files )
134129
135130 b .Assert (err , qt .IsNotNil )
136131 b .Assert (err .Error (), qt .Contains , `default language "sv" is disabled` )
@@ -174,13 +169,9 @@ pm31: {{ .Site.Params.pm3.pm31 }}
174169
175170
176171`
177- b := NewIntegrationTestBuilder (
178- IntegrationTestConfig {
179- T : t ,
180- TxtarString : files ,
181- Environ : []string {"HUGO_PARAMS_P2=p2env" , "HUGO_PARAMS_PM2_PM21=pm21env" , "HUGO_PARAMS_PM3_PM31=pm31env" },
182- },
183- ).Build ()
172+ b := Test (t , files , TestOptWithConfig (func (c * IntegrationTestConfig ) {
173+ c .Environ = []string {"HUGO_PARAMS_P2=p2env" , "HUGO_PARAMS_PM2_PM21=pm21env" , "HUGO_PARAMS_PM3_PM31=pm31env" }
174+ }))
184175
185176 b .AssertFileContent ("public/index.html" , "p1: p1base\n p2: p2env\n pm21: pm21env\n pm22: pm22base\n pm31: pm31env" )
186177 })
@@ -254,14 +245,9 @@ Home.
254245 for i , v := range environ {
255246 environ [i ] = strings .ReplaceAll (v , " " , delim )
256247 }
257- b := NewIntegrationTestBuilder (
258- IntegrationTestConfig {
259- T : t ,
260- TxtarString : files ,
261- Environ : environ ,
262- BuildCfg : BuildCfg {SkipRender : true },
263- },
264- ).Build ()
248+ b := Test (t , files , TestOptSkipRender (), TestOptWithConfig (func (c * IntegrationTestConfig ) {
249+ c .Environ = environ
250+ }))
265251
266252 conf := b .H .Configs .Base
267253 b .Assert (conf .DisableLanguages , qt .DeepEquals , []string {"no" , "sv" })
@@ -651,12 +637,7 @@ defaultMarkdownHandler = 'blackfriday'
651637
652638`
653639
654- b , err := NewIntegrationTestBuilder (
655- IntegrationTestConfig {
656- T : t ,
657- TxtarString : files ,
658- },
659- ).BuildE ()
640+ b , err := TestE (t , files )
660641
661642 b .Assert (err , qt .IsNotNil )
662643 b .Assert (err .Error (), qt .Contains , "Configured defaultMarkdownHandler \" blackfriday\" not found. Did you mean to use goldmark? Blackfriday was removed in Hugo v0.100.0." )
@@ -692,12 +673,7 @@ themeconfigdirparam: {{ site.Params.themeconfigdirparam }}
692673
693674 files := strings .ReplaceAll (filesTemplate , "hugo.toml" , configName )
694675
695- b , err := NewIntegrationTestBuilder (
696- IntegrationTestConfig {
697- T : t ,
698- TxtarString : files ,
699- },
700- ).BuildE ()
676+ b , err := TestE (t , files )
701677
702678 b .Assert (err , qt .IsNil )
703679 b .AssertFileContent ("public/index.html" ,
@@ -743,13 +719,9 @@ Single.
743719 files = strings .ReplaceAll (files , "WEIGHT_SV" , "2" )
744720
745721 cfg := config .New ()
746- b , err := NewIntegrationTestBuilder (
747- IntegrationTestConfig {
748- T : t ,
749- TxtarString : files ,
750- BaseCfg : cfg ,
751- },
752- ).BuildE ()
722+ b , err := TestE (t , files , TestOptWithConfig (func (c * IntegrationTestConfig ) {
723+ c .BaseCfg = cfg
724+ }))
753725
754726 b .Assert (err , qt .IsNil )
755727 b .AssertFileContent ("public/index.html" , "Home: en|2|" )
@@ -762,13 +734,9 @@ Single.
762734
763735 for range 20 {
764736 cfg := config .New ()
765- b , err := NewIntegrationTestBuilder (
766- IntegrationTestConfig {
767- T : t ,
768- TxtarString : files ,
769- BaseCfg : cfg ,
770- },
771- ).BuildE ()
737+ b , err := TestE (t , files , TestOptWithConfig (func (c * IntegrationTestConfig ) {
738+ c .BaseCfg = cfg
739+ }))
772740
773741 b .Assert (err , qt .IsNil )
774742 b .AssertFileContent ("public/index.html" , "Home: en|2|" )
@@ -801,12 +769,7 @@ Home.
801769
802770`
803771
804- b , err := NewIntegrationTestBuilder (
805- IntegrationTestConfig {
806- T : t ,
807- TxtarString : files ,
808- },
809- ).BuildE ()
772+ b , err := TestE (t , files )
810773
811774 b .Assert (err , qt .IsNil )
812775 b .AssertFileContent ("public/myindex.html" , "Home." )
@@ -836,12 +799,7 @@ ThisIsAParam: {{ site.Params.thisIsAParam }}
836799
837800`
838801
839- b , err := NewIntegrationTestBuilder (
840- IntegrationTestConfig {
841- T : t ,
842- TxtarString : files ,
843- },
844- ).BuildE ()
802+ b , err := TestE (t , files )
845803
846804 b .Assert (err , qt .IsNil )
847805 b .AssertFileContent ("public/index.html" , `
@@ -882,13 +840,7 @@ LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Lang
882840{{ end }}
883841
884842`
885- b := NewIntegrationTestBuilder (
886- IntegrationTestConfig {
887- T : t ,
888- TxtarString : files ,
889- LogLevel : logg .LevelWarn ,
890- },
891- ).Build ()
843+ b := Test (t , files , TestOptWarn ())
892844
893845 b .Assert (b .H .Log .LoggCount (logg .LevelWarn ), qt .Equals , 1 )
894846
@@ -936,13 +888,9 @@ func TestConfigHugoWorkingDir(t *testing.T) {
936888WorkingDir: {{ hugo.WorkingDir }}|
937889
938890`
939- b := NewIntegrationTestBuilder (
940- IntegrationTestConfig {
941- T : t ,
942- TxtarString : files ,
943- WorkingDir : "myworkingdir" ,
944- },
945- ).Build ()
891+ b := Test (t , files , TestOptWithConfig (func (c * IntegrationTestConfig ) {
892+ c .WorkingDir = "myworkingdir"
893+ }))
946894
947895 b .AssertFileContent ("public/index.html" , `
948896WorkingDir: myworkingdir|
@@ -1009,12 +957,7 @@ Home
1009957
1010958`
1011959
1012- b , err := NewIntegrationTestBuilder (
1013- IntegrationTestConfig {
1014- T : t ,
1015- TxtarString : files ,
1016- },
1017- ).BuildE ()
960+ b , err := TestE (t , files )
1018961
1019962 b .Assert (err , qt .IsNil )
1020963 b .AssertFileContent ("public/index.html" , `
@@ -1147,12 +1090,7 @@ Foo: {{ site.Params.foo }}|
11471090
11481091
11491092 `
1150- b , err := NewIntegrationTestBuilder (
1151- IntegrationTestConfig {
1152- T : t ,
1153- TxtarString : files ,
1154- },
1155- ).BuildE ()
1093+ b , err := TestE (t , files )
11561094
11571095 b .Assert (err , qt .IsNotNil )
11581096 b .Assert (err .Error (), qt .Contains , "invalid language configuration " )
@@ -1174,12 +1112,7 @@ weight = 1
11741112
11751113
11761114 `
1177- b , err := NewIntegrationTestBuilder (
1178- IntegrationTestConfig {
1179- T : t ,
1180- TxtarString : files ,
1181- },
1182- ).BuildE ()
1115+ b , err := TestE (t , files )
11831116
11841117 b .Assert (err , qt .IsNotNil )
11851118 b .Assert (err .Error (), qt .Contains , `defaultContentLanguage "sv" not found in languages configuration` )
@@ -1339,14 +1272,9 @@ func TestLoadConfigYamlEnvVar(t *testing.T) {
13391272 env = defaultEnv
13401273 }
13411274
1342- b := NewIntegrationTestBuilder (
1343- IntegrationTestConfig {
1344- T : t ,
1345- TxtarString : files ,
1346- Environ : env ,
1347- BuildCfg : BuildCfg {SkipRender : true },
1348- },
1349- ).Build ()
1275+ b := Test (t , files , TestOptSkipRender (), TestOptWithConfig (func (c * IntegrationTestConfig ) {
1276+ c .Environ = env
1277+ }))
13501278
13511279 outputs := b .H .Configs .Base .Outputs
13521280 if env == nil {
0 commit comments