Hey! First of all I would like to congratulate you the CookLang idea - it's amazing! You should have seen my mom's face when I opened a code editor to note down a family recipe. 😅
I was reading through the CookInSwift code just out of curiosity and I stumbled upon the ConfigParser'sadd method. I noticed that first item from every section is skipped by simply creating an empty section (sections[section] = []):
Please, notice that [fruit and veg] contains 3 elements in textConfig, while expected section content is 2 items only: ["bananas", "beetroots"].
[fruit and veg]
apples
bananas
beetroots
let sections = ["fruit and veg": ["bananas", "beetroots"],
"milk and dairy": ["egg"]]
Why is it so? Is it really the expected behavior?
I thought I will mention this because it smells like it's not and I think it might be issue hard to discover since it's already covered with passing test.
Hey! First of all I would like to congratulate you the
CookLang
idea - it's amazing! You should have seen my mom's face when I opened a code editor to note down a family recipe. 😅I was reading through the
CookInSwift
code just out of curiosity and I stumbled upon theConfigParser's
add
method. I noticed that firstitem
from everysection
is skipped by simply creating an empty section (sections[section] = []
):https://github.com/cooklang/CookInSwift/blob/b3b07f3d02cd1e719ca90be28ec222171ecff32a/Sources/CookInSwift/ConfigParser/ConfigParser.swift#L16-L24
Then with surprise I discovered that it's actually expected in the tests:
https://github.com/cooklang/CookInSwift/blob/b3b07f3d02cd1e719ca90be28ec222171ecff32a/Tests/CookInSwiftTests/ConfigParserTests.swift#L14-L40
Please, notice that
[fruit and veg]
contains 3 elements intextConfig
, while expected section content is 2 items only:["bananas", "beetroots"]
.Why is it so? Is it really the expected behavior? I thought I will mention this because it smells like it's not and I think it might be issue hard to discover since it's already covered with passing test.
Happy cooking! 🧑🍳