regexp-examples 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +0 -1
- data/Gemfile +3 -0
- data/LICENSE.txt +1 -1
- data/README.md +9 -3
- data/Rakefile +7 -2
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +667 -0
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.8.0/application.css +799 -0
- data/coverage/assets/0.8.0/application.js +1559 -0
- data/coverage/assets/0.8.0/colorbox/border.png +0 -0
- data/coverage/assets/0.8.0/colorbox/controls.png +0 -0
- data/coverage/assets/0.8.0/colorbox/loading.gif +0 -0
- data/coverage/assets/0.8.0/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.8.0/favicon_green.png +0 -0
- data/coverage/assets/0.8.0/favicon_red.png +0 -0
- data/coverage/assets/0.8.0/favicon_yellow.png +0 -0
- data/coverage/assets/0.8.0/loading.gif +0 -0
- data/coverage/assets/0.8.0/magnify.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/coverage-badge.png +0 -0
- data/coverage/index.html +4176 -0
- data/lib/regexp-examples/constants.rb +7 -2
- data/lib/regexp-examples/groups.rb +0 -3
- data/lib/regexp-examples/helpers.rb +0 -13
- data/lib/regexp-examples/version.rb +1 -1
- data/spec/regexp-examples_spec.rb +6 -1
- data/spec/spec_helper.rb +12 -61
- metadata +39 -11
@@ -12,8 +12,11 @@ module RegexpExamples
|
|
12
12
|
Lower = Array('a'..'z')
|
13
13
|
Upper = Array('A'..'Z')
|
14
14
|
Digit = Array('0'..'9')
|
15
|
-
|
16
|
-
|
15
|
+
# 45.chr = "-". Need to make sure this is at the START of the array, or things break
|
16
|
+
# This is because of the /[a-z]/ regex syntax, and how it's being parsed
|
17
|
+
Punct = [45..45, 33..44, 46..47, 58..64, 91..96, 123..126].map { |r| r.map { |val| val.chr } }.flatten
|
18
|
+
Hex = Array('a'..'f') | Array('A'..'F') | Digit
|
19
|
+
Any = Lower | Upper | Digit | Punct
|
17
20
|
end
|
18
21
|
|
19
22
|
# Map of special regex characters, to their associated character sets
|
@@ -24,6 +27,8 @@ module RegexpExamples
|
|
24
27
|
'W' => CharSets::Punct.reject { |val| val == '_' },
|
25
28
|
's' => [' ', "\t", "\n", "\r", "\v", "\f"],
|
26
29
|
'S' => CharSets::Any - [' ', "\t", "\n", "\r", "\v", "\f"],
|
30
|
+
'h' => CharSets::Hex,
|
31
|
+
'H' => CharSets::Any - CharSets::Hex,
|
27
32
|
|
28
33
|
't' => ["\t"], # tab
|
29
34
|
'n' => ["\n"], # new line
|
@@ -32,18 +32,5 @@ module RegexpExamples
|
|
32
32
|
CaptureGroupResult.new(nil, subgroups, result.join)
|
33
33
|
end
|
34
34
|
end
|
35
|
-
|
36
|
-
# TODO: For debugging only!! Delete this before v1.0
|
37
|
-
def self.show(regexp)
|
38
|
-
s = regexp.examples
|
39
|
-
puts "#{regexp.inspect} --> #{s.inspect}"
|
40
|
-
puts "Checking..."
|
41
|
-
errors = s.reject {|string| string =~ regexp}
|
42
|
-
if errors.size == 0
|
43
|
-
puts "All strings match"
|
44
|
-
else
|
45
|
-
puts "These don't match: #{errors.inspect}"
|
46
|
-
end
|
47
|
-
end
|
48
35
|
end
|
49
36
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
describe Regexp, "#examples" do
|
1
|
+
RSpec.describe Regexp, "#examples" do
|
2
2
|
def self.examples_exist_and_match(*regexps)
|
3
3
|
regexps.each do |regexp|
|
4
4
|
it do
|
@@ -70,8 +70,13 @@ describe Regexp, "#examples" do
|
|
70
70
|
context "for escaped characters" do
|
71
71
|
examples_exist_and_match(
|
72
72
|
/\w/,
|
73
|
+
/\W/,
|
73
74
|
/\s/,
|
75
|
+
/\S/,
|
74
76
|
/\d/,
|
77
|
+
/\D/,
|
78
|
+
/\h/,
|
79
|
+
/\H/,
|
75
80
|
/\t/,
|
76
81
|
/\n/,
|
77
82
|
/\f/,
|
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
# the additional setup, and require it from the spec files that actually need it.
|
12
|
-
#
|
13
|
-
# The `.rspec` file also contains a few flags that are not defaults but that
|
14
|
-
# users commonly want.
|
15
|
-
#
|
16
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start do
|
3
|
+
require 'simplecov-badge'
|
4
|
+
SimpleCov::Formatter::BadgeFormatter.strength_foreground = true
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
6
|
+
SimpleCov::Formatter::HTMLFormatter,
|
7
|
+
SimpleCov::Formatter::BadgeFormatter,
|
8
|
+
]
|
9
|
+
end
|
10
|
+
|
17
11
|
require './lib/regexp-examples.rb'
|
18
12
|
require 'pry'
|
13
|
+
|
19
14
|
RSpec.configure do |config|
|
20
|
-
# rspec-expectations config goes here. You can use an alternate
|
21
|
-
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
-
# assertions if you prefer.
|
23
15
|
config.expect_with :rspec do |expectations|
|
24
16
|
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
17
|
# and `failure_message` of custom matchers include text for helper methods
|
@@ -40,52 +32,11 @@ RSpec.configure do |config|
|
|
40
32
|
mocks.verify_partial_doubles = true
|
41
33
|
end
|
42
34
|
|
43
|
-
# The settings below are suggested to provide a good initial experience
|
44
|
-
# with RSpec, but feel free to customize to your heart's content.
|
45
|
-
=begin
|
46
|
-
# These two settings work together to allow you to limit a spec run
|
47
|
-
# to individual examples or groups you care about by tagging them with
|
48
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
49
|
-
# get run.
|
50
|
-
config.filter_run :focus
|
51
|
-
config.run_all_when_everything_filtered = true
|
52
|
-
|
53
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
54
|
-
# For more details, see:
|
55
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
56
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
57
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
58
35
|
config.disable_monkey_patching!
|
59
|
-
|
60
|
-
# This setting enables warnings. It's recommended, but in some cases may
|
61
|
-
# be too noisy due to issues in dependencies.
|
62
36
|
config.warnings = true
|
63
37
|
|
64
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
65
|
-
# file, and it's useful to allow more verbose output when running an
|
66
|
-
# individual spec file.
|
67
|
-
if config.files_to_run.one?
|
68
|
-
# Use the documentation formatter for detailed output,
|
69
|
-
# unless a formatter has already been configured
|
70
|
-
# (e.g. via a command-line flag).
|
71
|
-
config.default_formatter = 'doc'
|
72
|
-
end
|
73
|
-
|
74
38
|
# Print the 10 slowest examples and example groups at the
|
75
39
|
# end of the spec run, to help surface which specs are running
|
76
40
|
# particularly slow.
|
77
|
-
config.profile_examples = 10
|
78
|
-
|
79
|
-
# Run specs in random order to surface order dependencies. If you find an
|
80
|
-
# order dependency and want to debug it, you can fix the order by providing
|
81
|
-
# the seed, which is printed after each run.
|
82
|
-
# --seed 1234
|
83
|
-
config.order = :random
|
84
|
-
|
85
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
86
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
87
|
-
# test failures related to randomization by passing the same `--seed` value
|
88
|
-
# as the one that triggered the failure.
|
89
|
-
Kernel.srand config.seed
|
90
|
-
=end
|
41
|
+
#config.profile_examples = 10
|
91
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regexp-examples
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lord
|
@@ -14,28 +14,28 @@ dependencies:
|
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
description: Regexp#examples returns a list of strings what are matched by the regex
|
@@ -44,12 +44,41 @@ executables: []
|
|
44
44
|
extensions: []
|
45
45
|
extra_rdoc_files: []
|
46
46
|
files:
|
47
|
-
- .gitignore
|
48
|
-
- .rspec
|
47
|
+
- ".gitignore"
|
48
|
+
- ".rspec"
|
49
49
|
- Gemfile
|
50
50
|
- LICENSE.txt
|
51
51
|
- README.md
|
52
52
|
- Rakefile
|
53
|
+
- coverage/.last_run.json
|
54
|
+
- coverage/.resultset.json
|
55
|
+
- coverage/.resultset.json.lock
|
56
|
+
- coverage/assets/0.8.0/application.css
|
57
|
+
- coverage/assets/0.8.0/application.js
|
58
|
+
- coverage/assets/0.8.0/colorbox/border.png
|
59
|
+
- coverage/assets/0.8.0/colorbox/controls.png
|
60
|
+
- coverage/assets/0.8.0/colorbox/loading.gif
|
61
|
+
- coverage/assets/0.8.0/colorbox/loading_background.png
|
62
|
+
- coverage/assets/0.8.0/favicon_green.png
|
63
|
+
- coverage/assets/0.8.0/favicon_red.png
|
64
|
+
- coverage/assets/0.8.0/favicon_yellow.png
|
65
|
+
- coverage/assets/0.8.0/loading.gif
|
66
|
+
- coverage/assets/0.8.0/magnify.png
|
67
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
68
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
69
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
70
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
71
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
72
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
73
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
74
|
+
- coverage/assets/0.8.0/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
75
|
+
- coverage/assets/0.8.0/smoothness/images/ui-icons_222222_256x240.png
|
76
|
+
- coverage/assets/0.8.0/smoothness/images/ui-icons_2e83ff_256x240.png
|
77
|
+
- coverage/assets/0.8.0/smoothness/images/ui-icons_454545_256x240.png
|
78
|
+
- coverage/assets/0.8.0/smoothness/images/ui-icons_888888_256x240.png
|
79
|
+
- coverage/assets/0.8.0/smoothness/images/ui-icons_cd0a0a_256x240.png
|
80
|
+
- coverage/coverage-badge.png
|
81
|
+
- coverage/index.html
|
53
82
|
- lib/regexp-examples.rb
|
54
83
|
- lib/regexp-examples/backreferences.rb
|
55
84
|
- lib/regexp-examples/constants.rb
|
@@ -72,21 +101,20 @@ require_paths:
|
|
72
101
|
- lib
|
73
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
74
103
|
requirements:
|
75
|
-
- -
|
104
|
+
- - ">="
|
76
105
|
- !ruby/object:Gem::Version
|
77
106
|
version: '0'
|
78
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
108
|
requirements:
|
80
|
-
- -
|
109
|
+
- - ">="
|
81
110
|
- !ruby/object:Gem::Version
|
82
111
|
version: '0'
|
83
112
|
requirements: []
|
84
113
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.2.2
|
86
115
|
signing_key:
|
87
116
|
specification_version: 4
|
88
117
|
summary: Extends the Regexp class with '#examples'
|
89
118
|
test_files:
|
90
119
|
- spec/regexp-examples_spec.rb
|
91
120
|
- spec/spec_helper.rb
|
92
|
-
has_rdoc:
|