You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix trailing comment in last line recognized as leading comment for current token.
* add preferTrailingComment to IParseOptions
Co-authored-by: Alexander Fenster <[email protected]>
test.equal(root.lookup("Test2").comment,null,"should not parse //-blocks");
38
+
test.equal(root.lookup("Test3").comment,null,"should not parse /*-blocks");
39
+
40
+
test.equal(root.lookup("Test1.field1").comment,"Field with a comment.","should parse blocks for message fields");
41
+
test.equal(root.lookup("Test1.field2").comment,null,"should not parse lines for message fields");
42
+
test.equal(root.lookup("Test1.field3").comment,"Field with a comment and a <a href=\"http://example.com/foo/\">link</a>","should parse triple-slash lines for message fields");
43
+
44
+
test.equal(root.lookup("Test3").comments.ONE,"Value with a comment.","should parse blocks for enum values");
45
+
test.equal(root.lookup("Test3").comments.TWO,null,"should not parse lines for enum values");
46
+
test.equal(root.lookup("Test3").comments.THREE,"Value with a comment.","should prefer trailing comment when preferTrailingComment option enabled");
47
+
test.equal(root.lookup("Test3").comments.FOUR,"Other value with a comment.","should not confuse previous trailing comments with comments for the next field");
test.equal(root.lookup("Test1.field8").comment,null,"should parse no comment");
25
25
test.equal(root.lookup("Test1.field9").comment,"Field with a\nmulti-line comment.","should parse multiline double-slash field comment");
26
26
test.equal(root.lookup("Test1.field10").comment,"Field with a\nmulti-line doc-block comment.","should parse multiline doc-block field comment");
27
+
test.equal(root.lookup("Test1.field11").comment,"Field with both block comment","should parse both trailing comment and trailing comment");
28
+
test.equal(root.lookup("Test1.field12").comment,"Trailing comment in last line should not be recognized as leading comment for this field.","trailing comment in last line should not be recognized as leading comment for this field");
27
29
28
30
test.equal(root.lookup("Test3").comments.ONE,"Value with a comment.","should parse blocks for enum values");
29
31
test.equal(root.lookup("Test3").comments.TWO,"Value with a single-line comment.","should parse double-slash comments for enum values");
test.equal(root.lookup("Test3").comment,"Message\nwith\na\ncomment and stars.","should parse doc-block multiline comment");
55
+
56
+
test.equal(root.lookup("Test1.field1").comment,"Field with a doc-block comment.","should parse doc-block field comment");
57
+
test.equal(root.lookup("Test1.field2").comment,"Field with a single-line comment starting with two slashes.","should parse double-slash field comment");
58
+
test.equal(root.lookup("Test1.field3").comment,"Field with a single-line comment starting with three slashes.","should parse triple-slash field comment");
59
+
test.equal(root.lookup("Test1.field4").comment,"Field with a single-line slash-star comment.","should parse single-line slash-star field comment");
60
+
test.equal(root.lookup("Test1.field5").comment,"Field with a trailing single-line two-slash comment.","should parse trailing double-slash comment");
61
+
test.equal(root.lookup("Test1.field6").comment,"Field with a trailing single-line three-slash comment.","should parse trailing triple-slash comment");
62
+
test.equal(root.lookup("Test1.field7").comment,"Field with a trailing single-line slash-star comment.","should parse trailing slash-star comment");
63
+
test.equal(root.lookup("Test1.field8").comment,null,"should parse no comment");
64
+
test.equal(root.lookup("Test1.field9").comment,"Field with a\nmulti-line comment.","should parse multiline double-slash field comment");
65
+
test.equal(root.lookup("Test1.field10").comment,"Field with a\nmulti-line doc-block comment.","should parse multiline doc-block field comment");
66
+
test.equal(root.lookup("Test1.field11").comment,"and trailing comment.","should parse both trailing comment and trailing comment");
67
+
test.equal(root.lookup("Test1.field12").comment,"Trailing comment in last line should not be recognized as leading comment for this field.","trailing comment in last line should not be recognized as leading comment for this field");
68
+
69
+
test.equal(root.lookup("Test3").comments.ONE,"Value with a comment.","should parse blocks for enum values");
70
+
test.equal(root.lookup("Test3").comments.TWO,"Value with a single-line comment.","should parse double-slash comments for enum values");
71
+
test.equal(root.lookup("Test3").comments.THREE,"ignored","should prefer trailing comment when preferTrailingComment option enabled");
72
+
test.equal(root.lookup("Test3").comments.FOUR,"Other value with a comment.","should not confuse previous trailing comments with comments for the next field");
73
+
74
+
test.equal(root.lookup("ServiceTest.SingleLineMethod").comment,'My method does things');
test.equal(root.lookup("ServiceTest.ThreeLine012345678901234567890123456712345671234567123456783927483923473892837489238749832432874983274983274983274").comment,'Very very long method');
0 commit comments