mirror of
https://github.com/plexusorg/toml4j.git
synced 2025-02-11 03:30:00 +00:00
Added support for Unicode characters in quoted keys
This commit is contained in:
parent
1c87a9e85a
commit
d28fffa4e6
1 changed files with 11 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
|||
package com.moandjiezana.toml;
|
||||
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -102,6 +104,15 @@ public class QuotedKeysTest {
|
|||
assertEquals("type0", toml.getString("dog.\"type\".breed.name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_support_unicode() throws Exception {
|
||||
Toml toml = new Toml().parse("[[\"\\u00B1\"]]\n \"\\u00B1\" = \"a\"\n [\"\\u00B11\"]\n \"±\" = 1");
|
||||
|
||||
assertThat(toml.getTables("\"±\""), hasSize(1));
|
||||
assertEquals("a", toml.getTables("\"±\"").get(0).getString("\"±\""));
|
||||
assertEquals(1, toml.getTable("\"±1\"").getLong("\"±\"").intValue());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void should_fail_on_malformed_quoted_key() throws Exception {
|
||||
new Toml().parse("k\"ey\" = 1");
|
||||
|
|
Loading…
Reference in a new issue