From 411792aceeebd56554665b6aded8b469a54ce5a9 Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Wed, 12 Jul 2023 07:58:39 +0000 Subject: [PATCH] Ensures whitespace inside text in list pops isn't duplicated Testing was insufficent, and it caused us to miss an else if --- internal/dmapi/dmmap/dmmdata/parse.go | 2 +- internal/dmapi/dmmap/dmmdata/parse_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/dmapi/dmmap/dmmdata/parse.go b/internal/dmapi/dmmap/dmmdata/parse.go index 4e47dc37..d58709a4 100644 --- a/internal/dmapi/dmmap/dmmdata/parse.go +++ b/internal/dmapi/dmmap/dmmdata/parse.go @@ -111,7 +111,7 @@ func parse(file namedReader) (*DmmData, error) { currDatum = append(currDatum, c) } } - if inVarDataBlock { // retain any whitespace in the data block + else if inVarDataBlock { // retain any whitespace in the data block currDatum = append(currDatum, c) } continue diff --git a/internal/dmapi/dmmap/dmmdata/parse_test.go b/internal/dmapi/dmmap/dmmdata/parse_test.go index 5112d69f..dabf47b2 100644 --- a/internal/dmapi/dmmap/dmmdata/parse_test.go +++ b/internal/dmapi/dmmap/dmmdata/parse_test.go @@ -215,7 +215,7 @@ no_ws=1; } , /obj/foo2 , /obj/foo1 {no_ws=1} , /obj/foo3{ - liz = list("a" = 2, "c" = 3) + liz = list("a" = 2, "c" = 3, "long bit of text " = "other long bit of text") }) // Comment line that shouldn't flag TGM format @@ -248,7 +248,7 @@ no_ws=1; assert.Equal("/obj/foo3", prefabs[3].Path()) assert.ElementsMatch(prefabs[3].Vars().Iterate(), []string{"liz"}) - assert.Equal("list(\"a\" = 2, \"c\" = 3)", prefabs[3].Vars().ValueV("liz", "")) + assert.Equal("list(\"a\" = 2, \"c\" = 3, \"long bit of text \" = \"other long bit of text\")", prefabs[3].Vars().ValueV("liz", "")) } // Table-based test to check failure edge cases.