test/test_optionparser.rb in pdfmult-1.2.0 vs test/test_optionparser.rb in pdfmult-1.3.0

- old
+ new

@@ -16,11 +16,12 @@ :force => false, :infile => 'sample.pdf', :latex => false, :number => 2, :outfile => 'sample_2.pdf', - :pages => nil + :pages => nil, + :silent => false } options.must_equal expected end it 'should recognize the -n option and set the corresponding output filename' do @@ -46,19 +47,34 @@ it 'should recognize the -f option' do options = Pdfmult::Optionparser.parse!(['sample.pdf', '-f']) options[:force].must_equal true end + it 'should recognize the --no-force option' do + options = Pdfmult::Optionparser.parse!(['sample.pdf', '--no-force']) + options[:force].must_equal false + end + it 'should recognize the -l option and set the corresponding output filename' do options = Pdfmult::Optionparser.parse!(['sample.pdf', '-l']) options[:outfile].must_equal 'sample_2.tex' options[:latex].must_equal true end it 'should only accept positive -p option values' do lambda { Pdfmult::Optionparser.parse!(['sample.pdf', '-p', '0.5']) }.must_raise OptionParser::InvalidArgument lambda { Pdfmult::Optionparser.parse!(['sample.pdf', '-p', '0']) }.must_raise OptionParser::InvalidArgument lambda { Pdfmult::Optionparser.parse!(['sample.pdf', '-p', '-1']) }.must_raise OptionParser::InvalidArgument + end + + it 'should recognize the -s option' do + options = Pdfmult::Optionparser.parse!(['sample.pdf', '-s']) + options[:silent].must_equal true + end + + it 'should recognize the --no-silent option' do + options = Pdfmult::Optionparser.parse!(['sample.pdf', '--no-silent']) + options[:silent].must_equal false end it 'should not accept wrong number of arguments' do lambda { Pdfmult::Optionparser.parse!(['sample.pdf', 'sample2.pdf']) }.must_raise ArgumentError lambda { Pdfmult::Optionparser.parse!(['']) }.must_raise ArgumentError