Commit cd035c7e authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

@returns is now alias for @return.

parent 47440bda
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ module JsDuck
          boolean_at_tag(/@constructor/, :constructor)
        elsif look(/@param\b/) then
          at_param
        elsif look(/@return\b/) then
        elsif look(/@returns?\b/) then
          at_return
        elsif look(/@cfg\b/) then
          at_cfg
@@ -124,7 +124,7 @@ module JsDuck

    # matches @return {type} ...
    def at_return
      match(/@return/)
      match(/@returns?/)
      add_tag(:return)
      maybe_type
      skip_white
+9 −0
Original line number Diff line number Diff line
@@ -182,6 +182,15 @@ function f(foo, bar){}
    assert_equal("Some really\nlong comment.", docs[0][:return][:doc])
  end

  def test_returns_is_alias_for_return
    docs = JsDuck.parse("/**
 * @method
 * @returns {String} blah
 */")
    assert_equal("String", docs[0][:return][:type])
    assert_equal("blah", docs[0][:return][:doc])
  end

  def test_typeless_param_and_return
    docs = JsDuck.parse("/**
 * @method