Beispiel #1
0
 public void UnquoteWorks()
 {
     char[] SINGLE_ONLY       = new char[] { '\'' };
     char[] DOUBLE_ONLY       = new char[] { '"' };
     char[] SINGLE_AND_DOUBLE = new char[] { '\'', '"' };
     char[] TRUE_QUOTES       = new char[] { '“', '”' };
     // “test”
     Assert.AreEqual("test", MHString.Unquote("'test'", SINGLE_ONLY), "test 1 failed");
     Assert.AreEqual(" 'test' ", MHString.Unquote(" 'test' ", SINGLE_ONLY), "test 2 failed");
     Assert.AreEqual("test", MHString.Unquote("'test'", SINGLE_AND_DOUBLE), "test 3 failed");
     Assert.AreEqual("test", MHString.Unquote("\"test\"", SINGLE_AND_DOUBLE), "test 4 failed");
     Assert.AreEqual("\"test\"", MHString.Unquote("'\"test\"'", SINGLE_AND_DOUBLE), "test 5 failed");
     Assert.AreEqual("test", MHString.Unquote("'test\"", SINGLE_AND_DOUBLE), "test 6 failed"); // mixed quotes
     Assert.AreEqual("'test'", MHString.Unquote("'test'", new char[] { }), "test 7 failed");   // empty quote set
     Assert.AreEqual("test", MHString.Unquote("“test”", TRUE_QUOTES), "test 8 failed");
 }