Exemple #1
0
        public void Test1()
        {
            var cmd  = " ";
            var args = CommandToken.Parse(cmd).ToArray();

            AreEqual(args, new CommandSpaceToken(0, 1));
            Assert.AreEqual(cmd, CommandToken.ToString(args));
        }
Exemple #2
0
        public void Test2()
        {
            var cmd  = "show  state";
            var args = CommandToken.Parse(cmd).ToArray();

            AreEqual(args, new CommandStringToken(0, "show"), new CommandSpaceToken(4, 2), new CommandStringToken(6, "state"));
            Assert.AreEqual(cmd, CommandToken.ToString(args));
        }
Exemple #3
0
        public void Test5()
        {
            var cmd  = "show \"123\\\"456\"";
            var args = CommandToken.Parse(cmd).ToArray();

            AreEqual(args,
                     new CommandStringToken(0, "show"),
                     new CommandSpaceToken(4, 1),
                     new CommandQuoteToken(5, '"'),
                     new CommandStringToken(6, "123\\\"456"),
                     new CommandQuoteToken(14, '"')
                     );
            Assert.AreEqual(cmd, CommandToken.ToString(args));
        }
Exemple #4
0
        public void Test3()
        {
            var cmd  = "show \"hello world\"";
            var args = CommandToken.Parse(cmd).ToArray();

            AreEqual(args,
                     new CommandStringToken(0, "show"),
                     new CommandSpaceToken(4, 1),
                     new CommandQuoteToken(5, '"'),
                     new CommandStringToken(6, "hello world"),
                     new CommandQuoteToken(17, '"')
                     );
            Assert.AreEqual(cmd, CommandToken.ToString(args));
        }