Esempio n. 1
0
        public void plain_string_is_properly_parsed(string str)
        {
            CrayonString crayon = new CrayonString(str);
            var tokens = crayon.Tokenize();

            var sb = new StringBuilder();
            foreach (var token in tokens)
            {
                sb.Append(token.Text);
            }

            var removedExcapes = str.Replace($"{CrayonString.escapeStart}{CrayonString.escapeStart}", $"{CrayonString.escapeStart}");
            
            sb.ToString().ShouldEqual(removedExcapes);
        }
Esempio n. 2
0
        public void colors_are_properly_parsed(string str) {
                  CrayonString crayon = new CrayonString(str);
            var tokens = crayon.Tokenize();

            var sb = new StringBuilder();
            foreach (var token in tokens)
            {
                sb.Append(CrayonString.escapeStart)
                    .Append(token.Color.OriginalName)
                    .Append(CrayonString.escapeEnd);
                sb.Append(token.Text);
            }

            //var removedExcapes = str.Replace($"{CrayonString.escapeStart}{CrayonString.escapeStart}", $"{CrayonString.escapeStart}");
            
            sb.ToString().ShouldEqual(str);       
        }