public void UnescapeString() { string str = "\a\big\fool\named\ryo\thanks\vladimyr\\\""; string escapedStr = "\"\\a\\big\\fool\\named\\ryo\\thanks\\vladimyr\\\\\\\"\""; Assert.That(CStringEscapeHelper.Unescape(escapedStr), Is.EqualTo(str)); }
public void EscapesStringWithDifferentPrefixPostfix() { string prefix = "Lam"; string str = "pe\nsch"; string postfix = "irm"; string escapedStr = $"{prefix}pe\\nsch{postfix}"; Assert.That(CStringEscapeHelper.Escape(str, prefix, postfix), Is.EqualTo(escapedStr)); }
public void UnescapeCpp11StringLiterals() { string str = "foo"; Assert.That(CStringEscapeHelper.Unescape("L\"" + str + "\""), Is.EqualTo(str)); Assert.That(CStringEscapeHelper.Unescape("u\"" + str + "\""), Is.EqualTo(str)); Assert.That(CStringEscapeHelper.Unescape("u8\"" + str + "\""), Is.EqualTo(str)); Assert.That(CStringEscapeHelper.Unescape("U\"" + str + "\""), Is.EqualTo(str)); }
public void StringViewUnescapesStringsAndRemovesBraces() { string unescapedString = "somes\\tring\"view"; var remoteValue = RemoteValueFakeUtil.CreateSimpleString( "x", CStringEscapeHelper.Escape(unescapedString)); var varInfo = CreateVarInfo(remoteValue, "x"); Assert.That(varInfo.StringView, Is.EqualTo(unescapedString)); }
public void AddStringLiteral(string value, string prefix = "") { // Use a custom StringLiteralType. We should not rely on the standard types like // const char* etc. string escapedValue = prefix + CStringEscapeHelper.Escape(value); AddValueFromExpression( escapedValue, RemoteValueFakeUtil.CreateClass("StringLiteralType", "", escapedValue)); }
public void UnescapeStringWithTextAndOnlyOneQuote() { Assert.That(CStringEscapeHelper.Unescape("\"str\\n"), Is.Null); Assert.That(CStringEscapeHelper.Unescape("str\\n\""), Is.Null); }
public void UnescapeStringWithOnlyOneQuote() { Assert.That(CStringEscapeHelper.Unescape("\""), Is.Null); }
public void UnescapeStringWithMissingQuotes() { Assert.That(CStringEscapeHelper.Unescape("str\\n"), Is.Null); }
public void UnescapeEmptyString() { Assert.That(CStringEscapeHelper.Unescape(""), Is.Null); }
public void UnescapeNullString() { Assert.That(CStringEscapeHelper.Unescape(null), Is.Null); }
public void EscapeEmptyString() { Assert.That(CStringEscapeHelper.Escape(""), Is.EqualTo("\"\"")); }
public void UnescapeStringWithBadEscapeSequence() { Assert.That(CStringEscapeHelper.Unescape("\"\\g\""), Is.EqualTo("\\g")); }
public void UnescapeBackslashAtEnd() { Assert.That(CStringEscapeHelper.Unescape("\"str\\\""), Is.EqualTo("str\\")); }