mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-19 06:13:49 -07:00
Fixed issues with loading YamlConfigurations with typed keys
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.bukkit.configuration;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -22,9 +21,10 @@ public abstract class ConfigurationSectionTest {
|
||||
section.set("subsection.subkey2", true);
|
||||
section.set("subsection.subsubsection.key", true);
|
||||
section.set("key2", true);
|
||||
section.set("42", true);
|
||||
|
||||
assertArrayEquals(new String[] {"key", "subsection", "key2"}, section.getKeys(false).toArray());
|
||||
assertArrayEquals(new String[] {"key", "subsection", "subsection.subkey", "subsection.subkey2", "subsection.subsubsection", "subsection.subsubsection.key", "key2"}, section.getKeys(true).toArray());
|
||||
assertArrayEquals(new String[] {"key", "subsection", "key2", "42"}, section.getKeys(false).toArray());
|
||||
assertArrayEquals(new String[] {"key", "subsection", "subsection.subkey", "subsection.subkey2", "subsection.subsubsection", "subsection.subsubsection.key", "key2", "42"}, section.getKeys(true).toArray());
|
||||
assertArrayEquals(new String[] {"subkey", "subkey2", "subsubsection", "subsubsection.key"}, section.getConfigurationSection("subsection").getKeys(true).toArray());
|
||||
}
|
||||
|
||||
|
@@ -22,6 +22,7 @@ public abstract class ConfigurationTest {
|
||||
result.put("false-boolean", false);
|
||||
result.put("vector", new Vector(12345.67, 64, -12345.6789));
|
||||
result.put("list", Arrays.asList(1, 2, 3, 4, 5));
|
||||
result.put("42", "The Answer");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -36,7 +36,8 @@ public class YamlConfigurationTest extends FileConfigurationTest {
|
||||
"- 2\n" +
|
||||
"- 3\n" +
|
||||
"- 4\n" +
|
||||
"- 5\n";
|
||||
"- 5\n" +
|
||||
"'42': The Answer\n";
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user