test/unit/language/nodejs/provider/jsdoc/docstring_test.rb in inch-0.5.9 vs test/unit/language/nodejs/provider/jsdoc/docstring_test.rb in inch-0.5.10

- old
+ new

@@ -40,10 +40,31 @@ refute docstring.describes_internal_api? assert docstring.mentions_return? refute docstring.describes_return? end + it 'should notice things in jsdoc style docs 3' do + text = <<-DOC + /** + * + * This function takes `param1` and `param2` as arguments. + * + * @param {Number} param1 A number from 0 to 26 that will result in a letter a-z + * @param {String} param2 A text + * @return {String} A character from a-z based on the input number n + * + */ + DOC + docstring = described_class.new(text) + assert docstring.mentions_parameter?(:param1) + assert docstring.describes_parameter?(:param1) + assert docstring.mentions_parameter?(:param2) + assert docstring.describes_parameter?(:param2) + assert docstring.mentions_return? + assert docstring.describes_return? + end + it 'should notice things in jsdoc style docs' do %w(public protected private).each do |visibility| text = <<-DOC /** * Set or get the context `Runnable` to `runnable`. @@ -75,11 +96,11 @@ @param {Runnable} runnable the runnable to execute @return {Context} the context @api private DOC docstring = described_class.new(text) - assert_equal without_comment_markers.strip, docstring.without_comment_markers + assert_equal without_comment_markers.strip, docstring.to_s end it 'should remove comment markers for parsing 2' do text = <<-DOC /* @@ -89,21 +110,22 @@ DOC without_comment_markers = <<-DOC Set or get the context `Runnable` to `runnable`. DOC docstring = described_class.new(text) - assert_equal without_comment_markers.strip, docstring.without_comment_markers + assert_equal without_comment_markers.strip, docstring.to_s end it 'should remove comment markers for parsing 3' do text = <<-DOC - //Set or get the context `Runnable` to `runnable`. + // Set or get the context `Runnable` to `runnable`. + // Set or get the context `Runnable` to `runnable`. DOC without_comment_markers = <<-DOC Set or get the context `Runnable` to `runnable`. +Set or get the context `Runnable` to `runnable`. DOC docstring = described_class.new(text) - assert_equal without_comment_markers.strip, docstring.without_comment_markers + assert_equal without_comment_markers.strip, docstring.to_s end - end