Sha256: bb755400d59443cd999af8b19d6ee14d989442f8cee9fd7bfbb4a35c867471c5

Contents?: true

Size: 1.69 KB

Versions: 28

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__), "..", "parser_test_helper"))

class ArgumentDescriptionTest < Test::Unit::TestCase
  include PDocTestHelper
  include Basic
  include ArgumentDescription
  
  def setup
    @parser = ArgumentDescriptionParser.new
  end
  
  def test_argument_with_no_type
    fixture = parse("\n * - foo: a definition#{blank_line}")
    assert_equal "foo",                            fixture.name
    assert_equal [],                               fixture.types
    assert_equal "a definition",                   fixture.description
    
    fixture = parse("\n * - @foo: a definition#{blank_line}")
    assert_equal "foo",                            fixture.name
    assert_equal [],                               fixture.types
    assert_equal "a definition",                   fixture.description
    
    fixture = parse("\n * - foo:    a rather long definition  \n*     that extends to a second line.  #{blank_line}")
    assert_equal "a rather long definition that extends to a second line.", fixture.description
  end
  
  def test_argument_with_single_type
    fixture = parse("\n * - foo (String): a definition#{blank_line}")
    assert_equal "foo",                            fixture.name
    assert_equal %w[String],                       fixture.types
  end
  
  def test_argument_with_multiple_types
    fixture = parse("\n * - foo (String | Number): a definition#{blank_line}")
    assert_equal "foo",                            fixture.name
    assert_equal %w[String Number],                fixture.types
    fixture = parse("\n * - foo (String | Number | Object): a definition#{blank_line}")
    assert_equal %w[String Number Object],         fixture.types
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
distil-0.14.4 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.3 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.2 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.2.a vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.1 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.1.a vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.i vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.h vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.g vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.d vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.c vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.14.0.b vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.6 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.5 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.4 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.3 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.2 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.1 vendor/pdoc/test/unit/parser/argument_description_test.rb
distil-0.13.0 vendor/pdoc/test/unit/parser/argument_description_test.rb