Commit 0bac32b7 authored by Mygod's avatar Mygod

Add escape test for PluginOptions

parent 03a6b079
...@@ -25,7 +25,7 @@ import org.junit.Test ...@@ -25,7 +25,7 @@ import org.junit.Test
class PluginOptionsTest { class PluginOptionsTest {
@Test @Test
fun equal() { fun basic() {
val o1 = PluginOptions("obfs-local;obfs=http;obfs-host=localhost") val o1 = PluginOptions("obfs-local;obfs=http;obfs-host=localhost")
val o2 = PluginOptions("obfs-local", "obfs-host=localhost;obfs=http") val o2 = PluginOptions("obfs-local", "obfs-host=localhost;obfs=http")
Assert.assertEquals(o1.hashCode(), o2.hashCode()) Assert.assertEquals(o1.hashCode(), o2.hashCode())
...@@ -35,4 +35,19 @@ class PluginOptionsTest { ...@@ -35,4 +35,19 @@ class PluginOptionsTest {
val o4 = PluginOptions(o2.id, o2.toString()) val o4 = PluginOptions(o2.id, o2.toString())
Assert.assertEquals(true, o3 == o4) Assert.assertEquals(true, o3 == o4)
} }
@Test
fun escape() {
val options = PluginOptions("escapeTest")
options["subject"] = "value;semicolon"
Assert.assertEquals(true, options == PluginOptions(options.toString(false)))
options["key;semicolon"] = "object"
Assert.assertEquals(true, options == PluginOptions(options.toString(false)))
options["subject"] = "value=equals"
Assert.assertEquals(true, options == PluginOptions(options.toString(false)))
options["key=equals"] = "object"
Assert.assertEquals(true, options == PluginOptions(options.toString(false)))
options["advanced\\=;test"] = "in;=\\progress"
Assert.assertEquals(true, options == PluginOptions(options.toString(false)))
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment