Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324324

Summary: The LR Parser test utility function getCompletionNode gets a wrong offset.
Product: [Tools] CDT Reporter: John Liu <john_ws_liu>
Component: cdt-parserAssignee: Chris Recoskie <recoskie>
Status: RESOLVED FIXED QA Contact: Mike Kucera <mikekucera>
Severity: normal    
Priority: P3 CC: cdt-parser-inbox, recoskie
Version: 7.0   
Target Milestone: 7.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
a fix patch applied to org.eclipse.cdt.core.lrparser.tests recoskie: iplog+

Description John Liu CLA 2010-09-02 11:42:19 EDT
Build Identifier: 

The test utility function getCompletionNode(String code, ILanguage lang) in the class org.eclipse.cdt.core.lrparser.tests.ParseHelper gets a wrong offset due to a NEWLINE('\n') character appended to the code. 

It works for some test cases when it hits a complete key word, such as a->, since appended '\n' won't affect the completion node result. For example, the test case testNewExpressions_Bug313982a in the class  org.eclipse.cdt.core.lrparser.tests.LRCompletionBasicTest works.

But it will fail some test cases when it needs to find a proposal to an incomplete keyword. For example, the test cases testNewExpressions_Bug313982b and testNewExpressions_Bug313982c in the class  org.eclipse.cdt.core.lrparser.tests.LRCompletionBasicTest will fail to find a right  completion node due to this bug problem.



Reproducible: Always
Comment 1 John Liu CLA 2010-09-02 13:38:23 EDT
Created attachment 178072 [details]
a fix patch applied to org.eclipse.cdt.core.lrparser.tests

The fix will fix the recent CDT build test failures of 6 test cases for testBug313982b and testBug313982c.
Comment 2 Chris Recoskie CLA 2010-09-02 14:46:09 EDT
Applied to cdt_7_0 and HEAD.