public string PrepareMessage(string errorType, IFragment sourceFragment, string errorDescription)
        {
            OriginPosition pos = sourceFragment.GetBeginOriginPosition();

            return(String.Format(messageFormat, errorType, pos.LineNumber, pos.CharNumber,
                                 sourceFragment.GetOriginText(), errorDescription));
        }
示例#2
0
        public void EmptySourceFragmentTextTest()
        {
            string source = "";

            iOrigin = CreateOriginTest(source);
            iReader = iOrigin.GetReader();

            ILocation loc1 = iReader.CurrentLocation;

            iReader.MoveNext();
            ILocation loc2 = iReader.CurrentLocation;

            IFragment fr = iOrigin.MakeFragment(loc1, loc2);

            Assert.AreEqual(fr.GetOriginText(), "");
        }
示例#3
0
        public void WholeSourceFragmentTextTest()
        {
            string source = "I like reading sources!\nEspecially in tests.";

            iOrigin = CreateOriginTest(source);
            iReader = iOrigin.GetReader();

            ILocation locBeg = iReader.CurrentLocation;

            while (iReader.MoveNext())
            {
                ;                        // move to the end of source
            }
            ILocation locEnd = iReader.CurrentLocation;

            IFragment frAll = iOrigin.MakeFragment(locBeg, locEnd);

            Assert.AreEqual(frAll.GetOriginText(), source);
        }