@@ -273,6 +273,69 @@ GA ID: {{ site.Config.Services.GoogleAnalytics.ID }}.
273
273
b .AssertFileContent ("public/index.html" , "GA ID: foo bar." )
274
274
}
275
275
276
+ func TestMergeDeepBuildStats (t * testing.T ) {
277
+ t .Parallel ()
278
+
279
+ files := `
280
+ -- hugo.toml --
281
+ baseURL = "https://example.com"
282
+ title = "Theme 1"
283
+ _merge = "deep"
284
+ [module]
285
+ [module.hugoVersion]
286
+ [[module.imports]]
287
+ path = "theme1"
288
+ -- themes/theme1/hugo.toml --
289
+ [build]
290
+ [build.buildStats]
291
+ disableIDs = true
292
+ enable = true
293
+ -- layouts/home.html --
294
+ Home.
295
+
296
+ `
297
+
298
+ b := hugolib .Test (t , files , hugolib .TestOptOsFs ())
299
+
300
+ conf := b .H .Configs
301
+ base := conf .Base
302
+
303
+ b .Assert (base .Title , qt .Equals , "Theme 1" )
304
+ b .Assert (len (base .Module .Imports ), qt .Equals , 1 )
305
+ b .Assert (base .Build .BuildStats .Enable , qt .Equals , true )
306
+ b .AssertFileExists ("/hugo_stats.json" , true )
307
+ }
308
+
309
+ func TestMergeDeepBuildStatsTheme (t * testing.T ) {
310
+ t .Parallel ()
311
+
312
+ files := `
313
+ -- hugo.toml --
314
+ baseURL = "https://example.com"
315
+ _merge = "deep"
316
+ theme = ["theme1"]
317
+ -- themes/theme1/hugo.toml --
318
+ title = "Theme 1"
319
+ [build]
320
+ [build.buildStats]
321
+ disableIDs = true
322
+ enable = true
323
+ -- layouts/home.html --
324
+ Home.
325
+
326
+ `
327
+
328
+ b := hugolib .Test (t , files , hugolib .TestOptOsFs ())
329
+
330
+ conf := b .H .Configs
331
+ base := conf .Base
332
+
333
+ b .Assert (base .Title , qt .Equals , "Theme 1" )
334
+ b .Assert (len (base .Module .Imports ), qt .Equals , 1 )
335
+ b .Assert (base .Build .BuildStats .Enable , qt .Equals , true )
336
+ b .AssertFileExists ("/hugo_stats.json" , true )
337
+ }
338
+
276
339
func TestDefaultConfigLanguageBlankWhenNoEnglishExists (t * testing.T ) {
277
340
t .Parallel ()
278
341
0 commit comments