diff options
Diffstat (limited to 'hugolib/datafiles_test.go')
-rw-r--r-- | hugolib/datafiles_test.go | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/hugolib/datafiles_test.go b/hugolib/datafiles_test.go index a11929542..de124a77d 100644 --- a/hugolib/datafiles_test.go +++ b/hugolib/datafiles_test.go @@ -261,8 +261,7 @@ func TestDataDirMultipleSourcesCommingled(t *testing.T) { doTestDataDir(t, dd, expected, "theme", "mytheme") } -// TODO Issue #4366 unresolved -func _TestDataDirMultipleSourcesCollidingChildArrays(t *testing.T) { +func TestDataDirCollidingChildArrays(t *testing.T) { t.Parallel() var dd dataDir @@ -284,8 +283,7 @@ func _TestDataDirMultipleSourcesCollidingChildArrays(t *testing.T) { doTestDataDir(t, dd, expected, "theme", "mytheme") } -// TODO Issue #4366 unresolved -func _TestDataDirMultipleSourcesCollidingTopLevelArrays(t *testing.T) { +func TestDataDirCollidingTopLevelArrays(t *testing.T) { t.Parallel() var dd dataDir @@ -302,6 +300,27 @@ func _TestDataDirMultipleSourcesCollidingTopLevelArrays(t *testing.T) { doTestDataDir(t, dd, expected, "theme", "mytheme") } +func TestDataDirCollidingMapsAndArrays(t *testing.T) { + t.Parallel() + + var dd dataDir + // on + dd.addSource("themes/mytheme/data/a.json", `["1", "2", "3"]`) + dd.addSource("themes/mytheme/data/b.json", `{ "film" : "Logan Lucky" }`) + dd.addSource("data/a.json", `{ "music" : "Queen's Rebuke" }`) + dd.addSource("data/b.json", `["x", "y", "z"]`) + + expected := + map[string]interface{}{ + "a": map[string]interface{}{ + "music": "Queen's Rebuke", + }, + "b": []interface{}{"x", "y", "z"}, + } + + doTestDataDir(t, dd, expected, "theme", "mytheme") +} + type dataDir struct { sources [][2]string } |