Пример #1
0
        public void ShouldConvertSetsToUnicode(string source, string expected)
        {
            Assert.Equal(expected, SerializeSet(source));

            string SerializeSet(string expression, bool inverted = false)
            {
                var sb = new StringBuilder();

                Scanner.AppendConvertUnicodeSet(sb, expression, inverted);
                return(sb.ToString());
            }
        }
Пример #2
0
        public void ShouldConvertSetsToUnicodeSpecial()
        {
            // These values are altered by XUnit if passed in InlineData to ShouldConvertSetsToUnicode
            Assert.Equal("(?:(?:\ud83d[\udca9-\udcab]))", SerializeSet("💩-💫"));
            Assert.Equal("(?:(?:[\ud800-\ud83c][\udc00-\udfff]|\ud83d[\udc00-\udca9])|[\\u0061-\\uFFFF])", SerializeSet("a-💩"));

            string SerializeSet(string expression, bool inverted = false)
            {
                var sb = new StringBuilder();

                Scanner.AppendConvertUnicodeSet(sb, expression, inverted);
                return(sb.ToString());
            }
        }