trollop 1.16.1 → 1.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,6 @@
1
+ == 1.16.2 / 2010-04-06
2
+ * Bugfix in Trollop::options. Thanks to Brian C. Thomas for pointing it out.
3
+
1
4
  == 1.16.1 / 2010-04-05
2
5
  * Bugfix in Trollop::die method introduced in last release.
3
6
 
@@ -7,7 +7,7 @@ require 'date'
7
7
 
8
8
  module Trollop
9
9
 
10
- VERSION = "1.16.1"
10
+ VERSION = "1.16.2"
11
11
 
12
12
  ## Thrown by Parser in the event of a commandline error. Not needed if
13
13
  ## you're using the Trollop::options entry.
@@ -707,7 +707,7 @@ end
707
707
  ## See more examples at http://trollop.rubyforge.org.
708
708
  def options args=ARGV, *a, &b
709
709
  @last_parser = Parser.new(*a, &b)
710
- with_standard_exception_handling(p) { @last_parser.parse args }
710
+ with_standard_exception_handling(@last_parser) { @last_parser.parse args }
711
711
  end
712
712
 
713
713
  ## If Trollop::options doesn't do quite what you want, you can create a Parser
@@ -8,8 +8,8 @@ vi lib/trollop.rb # and bump version number
8
8
  git commit -a -m "bump to..."
9
9
  git tag release-<releasename>
10
10
  rake gem
11
- rake tarball
12
11
  gem push pkg/<gem name>
13
12
  git push
14
13
  git push --tags
14
+ rake upload_docs
15
15
  rake upload_webpage
@@ -1044,6 +1044,50 @@ EOM
1044
1044
  opts = @p.parse []
1045
1045
  assert_equal [], opts[:arg1]
1046
1046
  end
1047
+
1048
+ def test_simple_interface_handles_help
1049
+ ARGV.clear
1050
+ ARGV.unshift "-h"
1051
+ assert_raises(SystemExit) do
1052
+ opts = ::Trollop::options do
1053
+ opt :potato
1054
+ end
1055
+ raise "broken"
1056
+ end
1057
+ end
1058
+
1059
+ def test_simple_interface_handles_version
1060
+ ARGV.clear
1061
+ ARGV.unshift "-v"
1062
+ assert_raises(SystemExit) do
1063
+ opts = ::Trollop::options do
1064
+ version "1.2"
1065
+ opt :potato
1066
+ end
1067
+ raise "broken"
1068
+ end
1069
+ end
1070
+
1071
+ def test_simple_interface_handles_regular_usage
1072
+ ARGV.clear
1073
+ ARGV.unshift "--potato"
1074
+ opts = nil
1075
+ assert_nothing_raised do
1076
+ opts = ::Trollop::options do
1077
+ opt :potato
1078
+ end
1079
+ end
1080
+ assert opts[:potato]
1081
+ end
1082
+
1083
+ def test_simple_interface_handles_die
1084
+ ARGV.clear
1085
+ ARGV.unshift "--potato"
1086
+ opts = ::Trollop::options do
1087
+ opt :potato
1088
+ end
1089
+ assert_raises(SystemExit) { ::Trollop::die :potato, "is invalid" }
1090
+ end
1047
1091
  end
1048
1092
 
1049
1093
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trollop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-04-05 20:23:56 -04:00
12
+ date: 2010-04-06 11:53:33 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15