clasp-ruby 0.20.1 → 0.22.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), '../..', 'lib')
4
+
5
+ require 'clasp'
6
+
7
+ require 'xqsr3/extensions/test/unit'
8
+
9
+ require 'test/unit'
10
+
11
+ class Test_WithAction < Test::Unit::TestCase
12
+
13
+ def test_flag_with_action
14
+
15
+ debug = false
16
+
17
+ specifications = [
18
+
19
+ CLASP.Flag('--debug', alias: '-d') { debug = true }
20
+ ]
21
+ argv = []
22
+ args = CLASP.parse argv, specifications
23
+
24
+ assert_equal 0, args.flags.size
25
+ assert_equal 0, args.options.size
26
+ assert_equal 0, args.values.size
27
+
28
+ assert_false debug
29
+
30
+ argv2 = [ '--debug' ]
31
+ args2 = CLASP.parse argv2, specifications
32
+
33
+ assert_equal 1, args2.flags.size
34
+ assert_equal 0, args2.options.size
35
+ assert_equal 0, args2.values.size
36
+
37
+ assert_false debug
38
+
39
+ if ix = args2.flags.index('--debug')
40
+
41
+ flag = args2.flags[ix]
42
+
43
+ flag.argument_specification.action.call(flag, flag.argument_specification)
44
+ end
45
+
46
+ assert_true debug
47
+ end
48
+ end
49
+
50
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clasp-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.1
4
+ version: 0.22.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-19 00:00:00.000000000 Z
11
+ date: 2020-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xqsr3
@@ -48,6 +48,8 @@ files:
48
48
  - lib/clasp/doc_.rb
49
49
  - lib/clasp/old_module.rb
50
50
  - lib/clasp/specifications.rb
51
+ - lib/clasp/util/exceptions.rb
52
+ - lib/clasp/util/value_parser.rb
51
53
  - lib/clasp/version.rb
52
54
  - test/scratch/test_list_command_line.rb
53
55
  - test/scratch/test_specifications.rb
@@ -67,7 +69,9 @@ files:
67
69
  - test/unit/tc_option_required.rb
68
70
  - test/unit/tc_option_value_aliases.rb
69
71
  - test/unit/tc_specifications.rb
72
+ - test/unit/tc_typed_options.rb
70
73
  - test/unit/tc_usage.rb
74
+ - test/unit/tc_with_action.rb
71
75
  - test/unit/ts_all.rb
72
76
  homepage: http://github.com/synesissoftware/CLASP.Ruby
73
77
  licenses:
@@ -88,7 +92,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
92
  - !ruby/object:Gem::Version
89
93
  version: '0'
90
94
  requirements: []
91
- rubygems_version: 3.0.1
95
+ rubyforge_project:
96
+ rubygems_version: 2.4.5.5
92
97
  signing_key:
93
98
  specification_version: 4
94
99
  summary: CLASP.Ruby