Changeset 214
- Timestamp:
- 29-04-07 20:14:43 (6 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
moap/test/test_util_ctags.py (modified) (4 diffs)
-
moap/util/ctags.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r213 r214 1 2007-04-29 Thomas Vander Stichele <thomas at apestaart dot org> 2 3 * moap/util/ctags.py (CTags.getTags): 4 Make count include the given line, which makes more sense 5 compared to how a diff counts. 6 * moap/test/test_util_ctags.py (TestCTags.testGetManyTags, 7 TestCTags.testGetBeforeFirstTag, TestCTags.testGetWithFirstTag, 8 TestCTags.testGetTagBeforeTagLine, TestCTags.testGetTagOnTagLine, 9 TestCTags.testGetTagAfterTagLine, TestCTags.testGetLastTwo, 10 TestCTags.testGetLastTag): 11 Update tests for new getTags behaviour 12 1 13 2007-04-29 Thomas Vander Stichele <thomas at apestaart dot org> 2 14 -
trunk/moap/test/test_util_ctags.py
r150 r214 30 30 31 31 def testGetManyTags(self): 32 tags = self.ctags.getTags('moap/vcs/cvs.py', 93, 1 0)32 tags = self.ctags.getTags('moap/vcs/cvs.py', 93, 11) 33 33 self.assertEquals(tags[0].name, 'commit') 34 34 self.assertEquals(tags[1].name, 'diff') … … 36 36 def testGetBeforeFirstTag(self): 37 37 # asking for tags before there are any should return no tags 38 tags = self.ctags.getTags('moap/vcs/cvs.py', 5, 5)38 tags = self.ctags.getTags('moap/vcs/cvs.py', 5, 6) 39 39 self.failIf(tags) 40 40 41 41 def testGetWithFirstTag(self): 42 42 # asking for tags before and in first tag should give first tag 43 tags = self.ctags.getTags('moap/vcs/cvs.py', 15, 5)43 tags = self.ctags.getTags('moap/vcs/cvs.py', 15, 6) 44 44 self.assertEquals(len(tags), 1) 45 45 self.assertEquals(tags[0].name, 'detect') 46 46 47 47 def testGetTagBeforeTagLine(self): 48 tags = self.ctags.getTags('moap/vcs/cvs.py', 15 , 0)48 tags = self.ctags.getTags('moap/vcs/cvs.py', 15) 49 49 self.failIf(tags) 50 50 51 51 def testGetTagOnTagLine(self): 52 tags = self.ctags.getTags('moap/vcs/cvs.py', 16 , 0)52 tags = self.ctags.getTags('moap/vcs/cvs.py', 16) 53 53 self.assertEquals(len(tags), 1) 54 54 self.assertEquals(tags[0].name, 'detect') 55 55 56 56 def testGetTagAfterTagLine(self): 57 tags = self.ctags.getTags('moap/vcs/cvs.py', 17 , 0)57 tags = self.ctags.getTags('moap/vcs/cvs.py', 17) 58 58 self.assertEquals(len(tags), 1) 59 59 self.assertEquals(tags[0].name, 'detect') … … 61 61 def testGetLastTwo(self): 62 62 # update starts on 106 63 tags = self.ctags.getTags('moap/vcs/cvs.py', 105, 1)63 tags = self.ctags.getTags('moap/vcs/cvs.py', 105, 2) 64 64 self.assertEquals(len(tags), 2) 65 65 self.assertEquals(tags[0].name, 'diff') … … 67 67 68 68 def testGetLastTag(self): 69 tags = self.ctags.getTags('moap/vcs/cvs.py', 106 , 0)69 tags = self.ctags.getTags('moap/vcs/cvs.py', 106) 70 70 self.assertEquals(len(tags), 1) 71 71 self.assertEquals(tags[0].name, 'update') -
trunk/moap/util/ctags.py
r213 r214 82 82 self._files[t.file][t.line] = t 83 83 84 def getTags(self, file, line, count= 0):84 def getTags(self, file, line, count=1): 85 85 """ 86 86 Get all tags for the given file, starting at the given line number, 87 optionally counting count lines further.87 covered by the given count of lines from that point. 88 88 89 89 @returns: list of L{Tag} 90 90 """ 91 91 ret = [] 92 if count < 1: 93 return ret 94 92 95 tags = self._files[file] 93 96 starts = tags.keys() … … 121 124 # now find all tags in the given range and append 122 125 # it is possible we are already past the end of starts 123 while count and tags[starts[i]].line <=line + count:126 while count > 1 and tags[starts[i]].line < line + count: 124 127 startLine = starts[i] 125 128 t = tags[startLine]
Note: See TracChangeset
for help on using the changeset viewer.
