()
| 232 | } |
| 233 | |
| 234 | func (s *OptionsTestSuite) TestMap() { |
| 235 | s.Run("WithoutChildren", func() { |
| 236 | o := testOptions() |
| 237 | |
| 238 | expected := map[string]any{ |
| 239 | "string_key": "string_value", |
| 240 | "int_key": 42, |
| 241 | "float_key": 3.14, |
| 242 | "bool_key": true, |
| 243 | "group1.key1": "value1", |
| 244 | "group1.key2": 100, |
| 245 | "group2.key1": false, |
| 246 | "group2.key2": 2.71, |
| 247 | "group2.subgroup.key": "subvalue", |
| 248 | "group2.subgroup.num": 256, |
| 249 | } |
| 250 | |
| 251 | s.Require().Equal(expected, o.Map()) |
| 252 | }) |
| 253 | |
| 254 | s.Run("WithChildren", func() { |
| 255 | o := testNestedOptions() |
| 256 | |
| 257 | expected := map[string]any{ |
| 258 | "0.string_key": "string_value", |
| 259 | "0.int_key": 42, |
| 260 | "0.float_key": 3.14, |
| 261 | "0.bool_key": true, |
| 262 | "0.group1.key1": "value1", |
| 263 | "0.group1.key2": 100, |
| 264 | "0.group2.key1": false, |
| 265 | "0.group2.key2": 2.71, |
| 266 | "0.group2.subgroup.key": "subvalue", |
| 267 | "0.group2.subgroup.num": 256, |
| 268 | "1.string_key": "child_string_value", |
| 269 | "1.int_key": 84, |
| 270 | "1.child_only_key": "only_in_child", |
| 271 | "2.string_key": "grandchild_string_value", |
| 272 | "2.int_key": 168, |
| 273 | "2.grandchild_only_key": "only_in_grandchild", |
| 274 | } |
| 275 | |
| 276 | s.Require().Equal(expected, o.Map()) |
| 277 | }) |
| 278 | } |
| 279 | |
| 280 | func (s *OptionsTestSuite) TestNestedMap() { |
| 281 | s.Run("WithoutChildren", func() { |
nothing calls this directly
no test coverage detected