Posted 9 years ago by Matt Yaeger
Version: 10.1.0523
Avatar
Is there a preferred method for unit testing a custom parser? I tried the unit test below:

[TestMethod]
public void TestSimpleCVs()
{
SyntaxEditor se = new SyntaxEditor();
se.Document = new EditorDocument();
se.Document.Language = new CalculatedVariableCustomLanguage();
se.Text = "2.71";
}

This is what I do in my app. In my parser, in the Parse method I get an ITextSnapshotReader via as per samples:

ITextSnapshotReader reader = request.Snapshot.GetReader(0);

The problem is in my unit tests the reader.IsAtSnapShotEnd is always true.

Thanks

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Matt,

If your document's text has been updated then the snapshot reader shouldn't be saying IsAtSnapshotEnd == true when it's at the first offset. Could it be that the parser is getting called twice, once when the language is set and another when Text is set? Maybe try setting your document text first, before setting the language.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.