mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 19:24:15 +00:00
parent
bf08f527a2
commit
0c3448156c
3 changed files with 13 additions and 1 deletions
|
@ -155,7 +155,6 @@ class TomlParser extends BaseParser<Object> {
|
|||
@SuppressWarnings("unchecked")
|
||||
boolean addKeyGroup(String name) {
|
||||
String[] split = name.split("\\.");
|
||||
name = split[split.length - 1];
|
||||
|
||||
while (getContext().getValueStack().size() > 2) {
|
||||
drop();
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.moandjiezana.toml;
|
|||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -67,6 +68,14 @@ public class RealWorldTest {
|
|||
assertEquals(asList("]"), theHardBit.getList("multi_line_array", String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_allow_keys_with_same_name_in_different_groups() throws Exception {
|
||||
Toml toml = new Toml().parse(new File(getClass().getResource("should_allow_keys_with_same_name_in_different_groups.toml").getFile()));
|
||||
|
||||
assertTrue(toml.getKeyGroup("siteInfo.local.sh").getBoolean("enable"));
|
||||
assertFalse(toml.getKeyGroup("siteInfo.localMobile.sh").getBoolean("enable"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void printMap(Map<String, Object> map) {
|
||||
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[siteInfo.local.sh]
|
||||
enable=true
|
||||
[siteInfo.localMobile.sh]
|
||||
enable=false
|
Loading…
Reference in a new issue