spec/docstring_spec.rb in yard-0.2.3 vs spec/docstring_spec.rb in yard-0.2.3.2
- old
+ new
@@ -23,10 +23,14 @@
tag.text.should == "and this is a new paragraph:\n\nright here."
end
end
end
+ it "should handle docstrings with empty newlines" do
+ Docstring.new("\n\n").should == ""
+ end
+
it "should handle empty docstrings with #summary" do
o1 = Docstring.new
o1.summary.should == ""
end
@@ -57,9 +61,29 @@
@param name the tag name to return data for, or nil for all tags
@return [Array<Tags::Tag>] the list of tags by the specified tag name
eof
doc.summary.should == "Returns a list of tags specified by +name+ or all tags if +name+ is not specified."
+ end
+
+ it "should only parse tags with charset [A-Za-z_]" do
+ doc = Docstring.new
+ valid = %w( @testing @valid @is_a @is_A @__ )
+ invalid = %w( @ @return@ @param, @x.y @x-y )
+
+ log.enter_level(Logger::FATAL) do
+ {valid => 1, invalid => 0}.each do |tags, size|
+ tags.each do |tag|
+ class << doc
+ def create_tag(tag_name, *args)
+ add_tag Tags::Tag.new(tag_name, *args)
+ end
+ end
+ doc.all = tag
+ doc.tags(tag[1..-1]).size.should == size
+ end
+ end
+ end
end
it "should parse reference tag into ref_tags" do
doc = Docstring.new("@return (see Foo#bar)")
doc.ref_tags.size.should == 1