Created
September 9, 2008 16:23
-
-
Save tenderlove/9702 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsTest < NodeTestCase | |
def test_line_numbers | |
parser = RKelly::Parser.new | |
ast = parser.parse(<<-eojs) | |
/** | |
* This is an awesome test comment. | |
*/ | |
function aaron() { // This is a side comment | |
var x = 10; | |
return 1 + 1; // America! | |
} | |
eojs | |
func = ast.pointcut(FunctionDeclNode).matches.first | |
assert func | |
assert_match('awesome', func.comments[0].value) | |
assert_match('side', func.comments[1].value) | |
return_node = ast.pointcut(ReturnNode).matches.first | |
assert return_node | |
assert_match('America', return_node.comments[0].value) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment