test/unit/code_object/provider/yard/docstring_test.rb in inch-0.5.0.rc2 vs test/unit/code_object/provider/yard/docstring_test.rb in inch-0.5.0.rc3
- old
+ new
@@ -77,11 +77,53 @@
assert docstring.contains_code_example?
assert docstring.mentions_return?
assert docstring.describes_return?
end
+ it "should understand 'Returns nil.'" do
+text = <<-DOC
+[...]
+Returns nil.
+DOC
+ docstring = described_class.new(text)
+ assert docstring.describes_return?
+ end
+ it "should understand 'Returns nil.' without fullstop and in lowercase" do
+text = <<-DOC
+[...]
+returns nil
+DOC
+ docstring = described_class.new(text)
+ assert docstring.describes_return?
+ end
+
+ it "should understand 'Returns nothing.'" do
+text = <<-DOC
+[...]
+Returns nothing.
+DOC
+ docstring = described_class.new(text)
+ assert docstring.describes_return?
+ end
+
+ it "should understand 'Returns nothing.' without fullstop and in lowercase" do
+text = <<-DOC
+[...]
+returns nothing
+DOC
+ docstring = described_class.new(text)
+ assert docstring.describes_return?
+ end
+
+ it "should understand 'Returns ...' with a visibility modifier in front of it" do
+ text = "Public: Returns the Integer color."
+ docstring = described_class.new(text)
+ assert docstring.mentions_return?
+ assert docstring.describes_return?
+ end
+
#
# PARAMETER MENTIONS
#
@@ -94,10 +136,10 @@
refute docstring.mentions_parameter?(:format)
refute docstring.contains_code_example?
end
- it "should work 2" do
+ it "should work 2 if correct" do
text = <<-DOC
Just because format is mentioned here, does not mean
the first parameter is meant.
DOC
docstring = described_class.new(text)