Example #1
0
        public void DontRemoveBlankLines()
        {
            string text     = "Four score and\n\nseven years ago our fathers";
            string expected = "Four score and" + Environment.NewLine + Environment.NewLine + "seven years ago our fathers";
            string actual   = Reformat.Text(text);

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void RemoveWhiteSpace()
        {
            string text     = "  Four score and\n\t \tseven years ago our fathers";
            string expected = "Four score and seven years ago our fathers";
            string actual   = Reformat.Text(text);

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void RemoveNewLines()
        {
            string text     = "Four score and\nseven years\rago our\r\nfathers";
            string expected = "Four score and seven years ago our fathers";
            string actual   = Reformat.Text(text);

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void BlankLine()
        {
            string text     = "  Four score and\n   \nseven years\n\n    ago";
            string expected = "Four score and\n \nseven years\n \n  ago\n";
            string actual   = Reformat.Code(text);

            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public void ReplaceTabs()
        {
            string text     = "Four score and\tseven years\tago";
            string expected = "Four score and    seven years    ago\n";
            string actual   = Reformat.Code(text);

            Assert.AreEqual(expected, actual);
        }
Example #6
0
        public void DontRemovePadding()
        {
            string text     = "  Four score and\n   seven years\n ago";
            string expected = "Four score and\n seven years\n ago\n";
            string actual   = Reformat.Code(text);

            Assert.AreEqual(expected, actual);

            text     = "Four score and\n   seven years\n\tago our";
            expected = "Four score and\n   seven years\n    ago our\n";
            actual   = Reformat.Code(text);
            Assert.AreEqual(expected, actual);
        }
Example #7
0
        static void Main(string[] args)
        {
            var  inputFile = args[0];
            bool crush     = false;

            if (args.Length > 1)
            {
                if (args[1].ToLower() == "-crush")
                {
                    crush = bool.Parse(args[2]);
                }
            }

            Reformat.DoReformating(inputFile, crush);
        }