Loading spec/options_spec.rb +33 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,39 @@ describe JsDuck::Options::Parser do end end describe :external_classes do it "contains JavaScript builtins by default" do exts = parse().external_classes %w(Object String Number Boolean RegExp Function Array Arguments Date).each do |name| exts.should include(name) end end it "contains JavaScript builtin error classes by default" do exts = parse().external_classes exts.should include("Error") %w(Eval Range Reference Syntax Type URI).each do |name| exts.should include("#{name}Error") end end it "contains the special anything-goes Mixed type" do parse().external_classes.should include("Mixed") end it "can be used multiple times" do exts = parse("--external", "MyClass", "--external", "YourClass").external_classes exts.should include("MyClass") exts.should include("YourClass") end it "can be used with comma-separated list" do exts = parse("--external", "MyClass,YourClass").external_classes exts.should include("MyClass") exts.should include("YourClass") end end # Turns :attribute_name into "--option-name" or "--no-option-name" def opt(attr, negate=false) (negate ? "--no-" : "--") + attr.to_s.gsub(/_/, '-') Loading Loading
spec/options_spec.rb +33 −0 Original line number Diff line number Diff line Loading @@ -205,6 +205,39 @@ describe JsDuck::Options::Parser do end end describe :external_classes do it "contains JavaScript builtins by default" do exts = parse().external_classes %w(Object String Number Boolean RegExp Function Array Arguments Date).each do |name| exts.should include(name) end end it "contains JavaScript builtin error classes by default" do exts = parse().external_classes exts.should include("Error") %w(Eval Range Reference Syntax Type URI).each do |name| exts.should include("#{name}Error") end end it "contains the special anything-goes Mixed type" do parse().external_classes.should include("Mixed") end it "can be used multiple times" do exts = parse("--external", "MyClass", "--external", "YourClass").external_classes exts.should include("MyClass") exts.should include("YourClass") end it "can be used with comma-separated list" do exts = parse("--external", "MyClass,YourClass").external_classes exts.should include("MyClass") exts.should include("YourClass") end end # Turns :attribute_name into "--option-name" or "--no-option-name" def opt(attr, negate=false) (negate ? "--no-" : "--") + attr.to_s.gsub(/_/, '-') Loading