Hello! Thanks for the great linter.
I just fetched from svn, did sudo python setup.py install.
running python test.py does not report any problems.
It seems to work fine on my own js files (ie, it doesn't crash and it does find stuff). But running it with --unittest has 3 failures.
I thought you'd like to know.
Thanks so much!
Eric
Below is the output:
$ jsl --unittest
JavaScript Lint
Developed by Matthias Miller (http://www.JavaScriptLint.com)
...F..FF...........
======================================================================
FAIL: testSimpleComments (javascriptlint.jsparse.TestComments)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 287, in testSimpleComments
self._test('re = /\//g', ())
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 283, in _test
comments = findcomments(script, root)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 247, in findcomments
return filtercomments(possible_comments, node_positions, root_node)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 232, in filtercomments
process(root_node)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 231, in process
process(kid)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 231, in process
process(kid)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 231, in process
process(kid)
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 227, in process
end_offset = node_positions.to_offset(node.end_pos()) - 1
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 45, in to_offset
assert offset <= self._line_offsets[pos.line+1] # out-of-bounds col num
AssertionError
======================================================================
FAIL: testErrorPos (javascriptlint.jsparse.TestLineOffset)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 394, in testErrorPos
self.assertEquals(geterror(' ?', None), (0, 1, 'syntax_error'))
AssertionError: Tuples differ: (0, 2, 'syntax_error') != (0, 1, 'syntax_error')
First differing element 1:
2
1
- (0, 2, 'syntax_error')
? ^
+ (0, 1, 'syntax_error')
? ^
======================================================================
FAIL: testNodePos (javascriptlint.jsparse.TestLineOffset)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/javascriptlint/jsparse.py", line 405, in testNodePos
self.assertEquals(getnodepos('var x;', None), NodePos(0,0))
AssertionError: <pyspidermonkey.NodePos object at 0x97f7640> != <pyspidermonkey.NodePos object at 0x97f76d0>
----------------------------------------------------------------------
Ran 19 tests in 0.106s
FAILED (failures=3)
0 error(s), 0 warnings(s)
Thanks for the report! Tested with r308 and unit tests are passing.