Bug 228000 - [Tests] Add tests for the "Count lines in the patch" feature
Summary: [Tests] Add tests for the "Count lines in the patch" feature
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P4 minor (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Pawel Pogorzelski CLA
QA Contact:
URL:
Whiteboard: hasPatch
Keywords:
Depends on: 224588
Blocks:
  Show dependency tree
 
Reported: 2008-04-21 09:18 EDT by Tomasz Zarna CLA
Modified: 2009-06-02 07:16 EDT (History)
1 user (show)

See Also:


Attachments
Couple of jUnits (8.90 KB, patch)
2008-04-21 09:47 EDT, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (1.05 KB, application/octet-stream)
2008-04-21 09:47 EDT, Tomasz Zarna CLA
no flags Details
Patch 2 (9.75 KB, patch)
2008-04-21 10:31 EDT, Tomasz Zarna CLA
no flags Details | Diff
Patch_v03 (9.38 KB, patch)
2009-03-17 08:00 EDT, Pawel Pogorzelski CLA
no flags Details | Diff
Patch_v04 (10.03 KB, patch)
2009-03-17 11:27 EDT, Pawel Pogorzelski CLA
no flags Details | Diff
Patch_v05 (10.47 KB, patch)
2009-03-17 11:35 EDT, Pawel Pogorzelski CLA
pawel.pogorzelski1: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2008-04-21 09:18:34 EDT
To make sure the feature introduced with bug 224588 works as expected we will need a bunch of jUnits. They should cover:
* counting lines for patches in unified diff format
* counting lines for patches in context diff format
* counting lines for patches in standard diff format
* counting lines using given regular expressions
Comment 1 Tomasz Zarna CLA 2008-04-21 09:47:02 EDT
Created attachment 96846 [details]
Couple of jUnits
Comment 2 Tomasz Zarna CLA 2008-04-21 09:47:05 EDT
Created attachment 96847 [details]
mylyn/context/zip
Comment 3 Tomasz Zarna CLA 2008-04-21 10:31:53 EDT
Created attachment 96859 [details]
Patch 2

The previous patch was trying to use an unavailable getters from Hunk class. Since they're needed only for the purpose of testing I think it will be better to use reflection here.
Comment 4 Tomasz Zarna CLA 2008-08-05 05:21:07 EDT
Two tests fail, it's caused by the fact that PatchReader miscounts the number of lines in an empty file (before patching). Instead of 0 it returns 2. This happens only to context patches (ie patch_addition_context.txt, patch_oneline_context.txt).
Comment 5 Tomasz Zarna CLA 2008-09-16 09:51:46 EDT
Won't make it for 3.5M2.
Comment 6 Pawel Pogorzelski CLA 2009-03-17 08:00:46 EDT
Created attachment 129066 [details]
Patch_v03

Patch updated to HEAD.
Comment 7 Pawel Pogorzelski CLA 2009-03-17 11:27:53 EDT
Created attachment 129096 [details]
Patch_v04

Patch making a change in PatchReader along with the tests. This change makes the tests pass I'm not sure if it's a general fix though.
Comment 8 Pawel Pogorzelski CLA 2009-03-17 11:35:18 EDT
Created attachment 129097 [details]
Patch_v05

This one should be fine.

Tomasz, please provide some comments on the fix.
Comment 9 Tomasz Zarna CLA 2009-03-17 11:51:27 EDT
The fix looks fine, released to HEAD, available in builds >I20090317-1029. Thanks Pawel.