Commit 6d44108e authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Tests for empty @alias and @xtype tags.

parent 9c2cf01a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ module JsDuck
      match(/@xtype/)
      add_tag(:alias)
      skip_horiz_white
      @current_tag[:name] = "widget." + ident_chain
      @current_tag[:name] = "widget." + (ident_chain || "")
      skip_white
    end

@@ -330,7 +330,7 @@ module JsDuck
      match(/@ftype/)
      add_tag(:alias)
      skip_horiz_white
      @current_tag[:name] = "feature." + ident_chain
      @current_tag[:name] = "feature." + (ident_chain || "")
      skip_white
    end

+42 −0
Original line number Diff line number Diff line
@@ -46,6 +46,34 @@ describe JsDuck::Aggregator do
    it_should_behave_like "multiple aliases"
  end

  describe "class with @alias tag without name" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * @class MyClass
         * @alias
         */
      EOS
    end
    it "ignores the alias" do
      @doc[:aliases].should == {}
    end
  end

  describe "class with @alias tag without namespace" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * @class MyClass
         * @alias foo
         */
      EOS
    end
    it "ignores the alias" do
      @doc[:aliases].should == {}
    end
  end

  describe "class with @xtype" do
    before do
      @doc = parse(<<-EOS)[0]
@@ -58,6 +86,20 @@ describe JsDuck::Aggregator do
    it_should_behave_like "single alias"
  end

  describe "class with @xtype tag without name" do
    before do
      @doc = parse(<<-EOS)[0]
        /**
         * @class MyClass
         * @xtype
         */
      EOS
    end
    it "ignores the alias" do
      @doc[:aliases].should == {}
    end
  end

  describe "@xtype after @constructor" do
    before do
      @doc = parse(<<-EOS)[0]