opal 0.9.0.beta1 → 0.9.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -20
  3. data/CONTRIBUTING.md +8 -16
  4. data/lib/opal/compiler.rb +5 -0
  5. data/lib/opal/nodes/def.rb +10 -3
  6. data/lib/opal/nodes/definitions.rb +14 -3
  7. data/lib/opal/paths.rb +21 -4
  8. data/lib/opal/version.rb +1 -1
  9. data/opal/corelib/array.rb +1 -1
  10. data/opal/corelib/basic_object.rb +9 -9
  11. data/opal/corelib/constants.rb +2 -2
  12. data/opal/corelib/enumerable.rb +79 -2
  13. data/opal/corelib/error.rb +18 -0
  14. data/opal/corelib/helpers.rb +2 -8
  15. data/opal/corelib/kernel.rb +7 -7
  16. data/opal/corelib/module.rb +10 -10
  17. data/opal/corelib/number.rb +1 -1
  18. data/opal/corelib/regexp.rb +31 -30
  19. data/opal/corelib/string.rb +1 -1
  20. data/opal/corelib/struct.rb +8 -10
  21. data/opal/corelib/time.rb +4 -2
  22. data/opal/corelib/unsupported.rb +2 -2
  23. data/spec/filters/bugs/enumerable.rb +0 -19
  24. data/spec/filters/bugs/exception.rb +0 -4
  25. data/spec/filters/bugs/language.rb +7 -5
  26. data/spec/filters/bugs/module.rb +18 -19
  27. data/spec/filters/bugs/regexp.rb +0 -3
  28. data/spec/filters/bugs/set.rb +0 -8
  29. data/spec/filters/bugs/struct.rb +2 -2
  30. data/spec/filters/unsupported/bignum.rb +1 -0
  31. data/spec/filters/unsupported/language.rb +7 -0
  32. data/spec/lib/compiler_spec.rb +5 -0
  33. data/spec/lib/parser/undef_spec.rb +4 -0
  34. data/spec/lib/paths_spec.rb +11 -0
  35. data/spec/lib/spec_helper.rb +1 -1
  36. data/spec/opal/core/arity_spec.rb +142 -0
  37. data/spec/rubyspecs +1 -0
  38. data/stdlib/json.rb +13 -8
  39. data/stdlib/native.rb +1 -1
  40. data/stdlib/observer.rb +1 -1
  41. data/stdlib/ostruct.rb +1 -1
  42. data/stdlib/set.rb +33 -0
  43. data/tasks/testing.rake +8 -7
  44. metadata +7 -3
data/stdlib/ostruct.rb CHANGED
@@ -17,7 +17,7 @@ class OpenStruct
17
17
 
18
18
  def method_missing(name, *args)
19
19
  if args.length > 2
20
- raise NoMethodError.new "undefined method `#{name}' for #<OpenStruct>"
20
+ raise NoMethodError.new("undefined method `#{name}' for #<OpenStruct>", name)
21
21
  end
22
22
  if name.end_with? '='
23
23
  if args.length != 1
data/stdlib/set.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # Portions Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
1
2
  class Set
2
3
  include Enumerable
3
4
 
@@ -155,6 +156,38 @@ class Set
155
156
  dup.merge(enum)
156
157
  end
157
158
 
159
+ def superset?(set)
160
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
161
+ return false if size < set.size
162
+ set.all? { |o| include?(o) }
163
+ end
164
+
165
+ alias >= superset?
166
+
167
+ def proper_superset?(set)
168
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
169
+ return false if size <= set.size
170
+ set.all? { |o| include?(o) }
171
+ end
172
+
173
+ alias > proper_superset?
174
+
175
+ def subset?(set)
176
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
177
+ return false if set.size < size
178
+ all? { |o| set.include?(o) }
179
+ end
180
+
181
+ alias <= subset?
182
+
183
+ def proper_subset?(set)
184
+ set.is_a?(Set) or raise ArgumentError, "value must be a set"
185
+ return false if set.size <= size
186
+ all? { |o| set.include?(o) }
187
+ end
188
+
189
+ alias < proper_subset?
190
+
158
191
  alias + |
159
192
  alias union |
160
193
 
data/tasks/testing.rake CHANGED
@@ -55,8 +55,8 @@ module Testing
55
55
  elsif suite == 'rubyspec'
56
56
  add_specs['spec/rubyspec', rubyspecs]
57
57
  else
58
- warn 'Please provide at lease one of the following ENV vars:'
59
- warn 'PATTERN # e.g. env PATTERN="spec/rubyspec/core/numeric/**_spec.rb"'
58
+ warn 'Please provide at lease one of the following environment variables:'
59
+ warn 'PATTERN # e.g. PATTERN=spec/rubyspec/core/numeric/**_spec.rb'
60
60
  warn 'SUITE # can be either SUITE=opal or SUITE=rubyspec'
61
61
  exit 1
62
62
  end
@@ -85,18 +85,19 @@ module Testing
85
85
  index = 0
86
86
  begin
87
87
  index += 1
88
- bm_filepath = "tmp/bench/Spec#{index}"
89
- end while File.exist?(bm_filepath)
88
+ filepath = "tmp/bench/Spec#{index}"
89
+ end while File.exist?(filepath)
90
+ filepath
90
91
  end
91
92
  end
92
93
 
93
94
  pattern_usage = <<-DESC
94
- Use PATTERN and env var to manually set the glob for specs:
95
+ Use PATTERN environment variable to manually set the glob for specs:
95
96
 
96
97
  # Will run all specs matching the specified pattern.
97
98
  # (Note: the rubyspecs filters will still apply)
98
- env PATTERN="spec/rubyspec/core/module/class_variable*_spec.rb" rake mspec_node
99
- env PATTERN="spec/rubyspec/core/numeric/**_spec.rb" rake mspec_node
99
+ bundle exec rake mspec_node PATTERN=spec/rubyspec/core/module/class_variable*_spec.rb
100
+ bundle exec rake mspec_node PATTERN=spec/rubyspec/core/numeric/**_spec.rb
100
101
  DESC
101
102
 
102
103
  %w[rubyspec opal].each do |suite|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.beta1
4
+ version: 0.9.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-19 00:00:00.000000000 Z
11
+ date: 2015-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sourcemap
@@ -570,6 +570,7 @@ files:
570
570
  - spec/lib/parser/while_spec.rb
571
571
  - spec/lib/parser/yield_spec.rb
572
572
  - spec/lib/path_reader_spec.rb
573
+ - spec/lib/paths_spec.rb
573
574
  - spec/lib/shared/path_finder_shared.rb
574
575
  - spec/lib/shared/path_reader_shared.rb
575
576
  - spec/lib/spec_helper.rb
@@ -580,6 +581,7 @@ files:
580
581
  - spec/lib/sprockets_spec.rb
581
582
  - spec/lib/tilt/opal_spec.rb
582
583
  - spec/opal/compiler/irb_spec.rb
584
+ - spec/opal/core/arity_spec.rb
583
585
  - spec/opal/core/array/intersection_spec.rb
584
586
  - spec/opal/core/array/minus_spec.rb
585
587
  - spec/opal/core/array/select_spec.rb
@@ -1087,7 +1089,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1087
1089
  version: 1.3.1
1088
1090
  requirements: []
1089
1091
  rubyforge_project:
1090
- rubygems_version: 2.4.5.1
1092
+ rubygems_version: 2.4.8
1091
1093
  signing_key:
1092
1094
  specification_version: 4
1093
1095
  summary: Ruby runtime and core library for JavaScript
@@ -1203,6 +1205,7 @@ test_files:
1203
1205
  - spec/lib/parser/while_spec.rb
1204
1206
  - spec/lib/parser/yield_spec.rb
1205
1207
  - spec/lib/path_reader_spec.rb
1208
+ - spec/lib/paths_spec.rb
1206
1209
  - spec/lib/shared/path_finder_shared.rb
1207
1210
  - spec/lib/shared/path_reader_shared.rb
1208
1211
  - spec/lib/spec_helper.rb
@@ -1213,6 +1216,7 @@ test_files:
1213
1216
  - spec/lib/sprockets_spec.rb
1214
1217
  - spec/lib/tilt/opal_spec.rb
1215
1218
  - spec/opal/compiler/irb_spec.rb
1219
+ - spec/opal/core/arity_spec.rb
1216
1220
  - spec/opal/core/array/intersection_spec.rb
1217
1221
  - spec/opal/core/array/minus_spec.rb
1218
1222
  - spec/opal/core/array/select_spec.rb