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

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.


Comments (1)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
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 (v24.1.2) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.