ReadExtraNewLine() public method

public ReadExtraNewLine ( ) : char
return char
Ejemplo n.º 1
0
        public void _標準入力からの取得をシミュレーション_入力補完あり2(string inPartial, string inExpected)
        {
            var dic = ConsoleAppHelper.ListCommands();
            var buf = new FakeConsoleReadBuffer(dic, inPartial)
            {
                Prompt = "> ",
            };

            Assert.That(buf.InCompleting, Is.False);

            buf.ReadToEnd();
            Assert.That(buf.Current, Is.EqualTo(inPartial));
            Assert.That(buf.InCompleting, Is.False);

            Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last()));
            Assert.That(buf.Current, Is.EqualTo(inExpected));
            Assert.That(buf.InCompleting, Is.True);

            Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last()));
            Assert.That(buf.Current, Is.EqualTo(inExpected));
            Assert.That(buf.InCompleting, Is.True);

            Assert.That(buf.ReadExtraNewLine(), Is.EqualTo('\n'));
            Assert.That(buf.Current, Is.Null.Or.Empty);
            Assert.That(buf.History.Any(), Is.True);
            Assert.That(buf.History.Last(), Is.EqualTo(inExpected));
        }
Ejemplo n.º 2
0
        public void _標準入力からの取得をシミュレーション(string inExpected)
        {
            var buf = new FakeConsoleReadBuffer(new string[0], inExpected) {
                Prompt = "> ",
            };

            Assert.That(buf.Cursor, Is.EqualTo(0));
            Assert.That(buf.History.Any(), Is.False);
            Assert.That(buf.Current, Is.Null.Or.Empty);

            foreach (var e in inExpected.Select((c, i) => Tuple.Create(i, c))) {
                Assert.That(buf.Read(), Is.EqualTo(e.Item2));

                Assert.That(buf.Cursor, Is.EqualTo(e.Item1+1));
                Assert.That(buf.Current, Is.EqualTo(inExpected.Substring(0, buf.Cursor)));
                Assert.That(buf.History.Any(), Is.False);
            }

            Assert.That(buf.ReadExtraNewLine(), Is.EqualTo('\n'));

            Assert.That(buf.Cursor, Is.EqualTo(0));
            Assert.That(buf.Current, Is.Null.Or.Empty);
            Assert.That(buf.History.Any(), Is.True);
            Assert.That(buf.History.Last(), Is.EqualTo(inExpected));
        }
Ejemplo n.º 3
0
        public void _標準入力からの取得をシミュレーション(string inExpected)
        {
            var buf = new FakeConsoleReadBuffer(new string[0], inExpected)
            {
                Prompt = "> ",
            };

            Assert.That(buf.Cursor, Is.EqualTo(0));
            Assert.That(buf.History.Any(), Is.False);
            Assert.That(buf.Current, Is.Null.Or.Empty);

            foreach (var e in inExpected.Select((c, i) => Tuple.Create(i, c)))
            {
                Assert.That(buf.Read(), Is.EqualTo(e.Item2));

                Assert.That(buf.Cursor, Is.EqualTo(e.Item1 + 1));
                Assert.That(buf.Current, Is.EqualTo(inExpected.Substring(0, buf.Cursor)));
                Assert.That(buf.History.Any(), Is.False);
            }

            Assert.That(buf.ReadExtraNewLine(), Is.EqualTo('\n'));

            Assert.That(buf.Cursor, Is.EqualTo(0));
            Assert.That(buf.Current, Is.Null.Or.Empty);
            Assert.That(buf.History.Any(), Is.True);
            Assert.That(buf.History.Last(), Is.EqualTo(inExpected));
        }
Ejemplo n.º 4
0
        public void _標準入力からの取得をシミュレーション_入力補完あり2(string inPartial, string inExpected)
        {
            var dic = ConsoleAppHelper.ListCommands();
            var buf = new FakeConsoleReadBuffer(dic, inPartial) {
                Prompt = "> ",
            };

            Assert.That(buf.InCompleting, Is.False);

            buf.ReadToEnd();
            Assert.That(buf.Current, Is.EqualTo(inPartial));
            Assert.That(buf.InCompleting, Is.False);

            Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last()));
            Assert.That(buf.Current, Is.EqualTo(inExpected));
            Assert.That(buf.InCompleting, Is.True);

            Assert.That(buf.ReadExtraTab(), Is.EqualTo(inExpected.Last()));
            Assert.That(buf.Current, Is.EqualTo(inExpected));
            Assert.That(buf.InCompleting, Is.True);

            Assert.That(buf.ReadExtraNewLine(), Is.EqualTo('\n'));
            Assert.That(buf.Current, Is.Null.Or.Empty);
            Assert.That(buf.History.Any(), Is.True);
            Assert.That(buf.History.Last(), Is.EqualTo(inExpected));
        }