opal 0.10.0.beta5 → 0.10.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c079b409f97e61407c4fe72410565e475393de5
4
- data.tar.gz: 601de648a70c52b79d640bc915c97d4d87f11273
3
+ metadata.gz: e2a873c45ca2ab2562848657e97a18d95d7891fe
4
+ data.tar.gz: 21c65698f96153b278c4353b86d629277a0da384
5
5
  SHA512:
6
- metadata.gz: 25bbc576b16cb4606e431feaacc48207b25979d011966128f9498009c9c28088fea42f1ea46e910a88f89eca0fbdb77e3122c491b6fdf74b3ba46539227a456d
7
- data.tar.gz: fffbb29d78a7284282ab7deab869406aab8f739779a45859426d4092e12f2abdbca71d5703ed6878e4f4fcfdcdc36e3ed8398042dc89db66327bdf00c3c97042
6
+ metadata.gz: efb186e9bf8740c1576320ab79f3ee52a75fdaed4700e5e4bd802c3ecf535cdd181a081bdd792002c829f7618448e34caef000a32b1fb4b31ae47ce942875cb9
7
+ data.tar.gz: de65d4412a33c2faf634be26390a48c598cfd1a413420929b01f5e46e8c34a85daa70fc03f1fb2552506b315a8f32479b89f19dcc5e1709874e26d57aec462c1
data/.gitignore CHANGED
@@ -15,5 +15,6 @@ build/
15
15
  .rspec-local
16
16
  /coverage
17
17
 
18
- # Ignore the location of the older (0.8 and below) rubyspec submodule location
18
+ # Ignore old submodules, useful when switching branches
19
19
  spec/corelib
20
+ spec/rubyspec
data/CHANGELOG.md CHANGED
@@ -57,6 +57,7 @@ Whitespace conventions:
57
57
  - if-conditions now support `null` and `undefined` as falsy values (#867)
58
58
  - Implement IO.read method for Node.js (#1332)
59
59
  - Implement IO.each_line method for Node.js (#1221)
60
+ - Generate `opal-builder.js` to ease the compilation of Ruby library from JavaScript (#1290)
60
61
 
61
62
 
62
63
  ### Changed
@@ -11,7 +11,7 @@ module Opal
11
11
 
12
12
  def run(source, argv)
13
13
  unless argv.empty?
14
- raise ArgumentError, 'Program arguments are not supported on the PhantomJS runner'
14
+ raise ArgumentError, 'Program arguments are not supported on the Server runner'
15
15
  end
16
16
 
17
17
  require 'rack'
@@ -82,6 +82,7 @@ module Opal
82
82
 
83
83
  def compile_block_arg
84
84
  if block_arg
85
+ block_arg = variable(self.block_arg.to_s)
85
86
  scope.block_name = block_arg
86
87
  scope.add_temp block_arg
87
88
  scope_name = scope.identify!
@@ -68,7 +68,7 @@ module Opal
68
68
  def process_requires(requires, context)
69
69
  requires.each do |required|
70
70
  required = required.to_s.sub(sprockets_extnames_regexp, '')
71
- context.require_asset required unless stubbed_files.include? required
71
+ context.require_asset required unless ::Opal::Config.stubbed_files.include? required
72
72
  end
73
73
  end
74
74
 
data/lib/opal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  # WHEN RELEASING:
3
3
  # Remember to update RUBY_ENGINE_VERSION in opal/corelib/constants.rb too!
4
- VERSION = '0.10.0.beta5'
4
+ VERSION = '0.10.0.rc1'
5
5
  end
@@ -554,6 +554,14 @@ class Array < `Array`
554
554
  self
555
555
  end
556
556
 
557
+ def count(object = nil, &block)
558
+ if object || block
559
+ super
560
+ else
561
+ size
562
+ end
563
+ end
564
+
557
565
  def initialize_copy(other)
558
566
  replace other
559
567
  end
@@ -1,8 +1,8 @@
1
1
  RUBY_PLATFORM = 'opal'
2
2
  RUBY_ENGINE = 'opal'
3
3
  RUBY_VERSION = '2.2.3'
4
- RUBY_ENGINE_VERSION = '0.10.0.beta5'
5
- RUBY_RELEASE_DATE = '2015-12-20'
4
+ RUBY_ENGINE_VERSION = '0.10.0.rc1'
5
+ RUBY_RELEASE_DATE = '2016-06-07'
6
6
  RUBY_PATCHLEVEL = 0
7
7
  RUBY_REVISION = 0
8
8
  RUBY_COPYRIGHT = 'opal - Copyright (C) 2013-2015 Adam Beynon'
@@ -112,30 +112,21 @@ module Enumerable
112
112
  end
113
113
 
114
114
  def count(object = undefined, &block)
115
- %x{
116
- var result = 0;
117
-
118
- if (object != null) {
119
- block = function() {
120
- return #{Opal.destructure(`arguments`) == `object`};
121
- };
122
- }
123
- else if (block === nil) {
124
- block = function() { return true; };
125
- }
115
+ result = 0
126
116
 
127
- self.$each.$$p = function() {
128
- var value = Opal.yieldX(block, arguments);
129
-
130
- if (#{Opal.truthy?(`value`)}) {
131
- result++;
132
- }
133
- }
117
+ if `object != null`
118
+ block = proc do |*args|
119
+ Opal.destructure(args) == object
120
+ end
121
+ elsif block.nil?
122
+ block = proc { true }
123
+ end
134
124
 
135
- self.$each();
125
+ each do |*args|
126
+ `result++` if `Opal.yieldX(block, args)`
127
+ end
136
128
 
137
- return result;
138
- }
129
+ result
139
130
  end
140
131
 
141
132
  def cycle(n = nil, &block)
@@ -7,6 +7,7 @@ opal_filter "BasicObject" do
7
7
  fails "BasicObject#instance_eval raises a TypeError when defining methods on an immediate"
8
8
  fails "BasicObject#instance_eval raises a TypeError when defining methods on numerics"
9
9
  fails "BasicObject#instance_eval sets class variables in the receiver"
10
+ fails "BasicObject#instance_eval evaluates string with given filename and linenumber"
10
11
  fails "BasicObject#instance_exec binds the block's binding self to the receiver"
11
12
  fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
12
13
  fails "BasicObject#instance_exec raises a TypeError when defining methods on an immediate"
@@ -283,6 +283,7 @@ opal_filter "Kernel" do
283
283
  fails "Kernel.printf calls write on the first argument when it is not a string"
284
284
  fails "Kernel.printf writes to stdout when a string is the first argument"
285
285
  fails "Kernel.proc is a private method"
286
+ fails "Kernel.rand returns nil when range is backwards"
286
287
  fails "Kernel.rand is a private method"
287
288
  fails "Kernel.srand accepts a Bignum as a seed"
288
289
  fails "Kernel.srand accepts a negative seed"
@@ -105,6 +105,7 @@ opal_filter "language" do
105
105
  fails "The defined? keyword for a scoped constant does not call .const_missing if the constant is not defined"
106
106
  fails "The defined? keyword for a scoped constant returns nil when a constant is defined on top-level but not on the module"
107
107
  fails "The defined? keyword for a scoped constant returns nil when an undefined constant is scoped to a defined constant"
108
+ fails "The defined? keyword for a scoped constant returns nil when a constant is scoped to an undefined constant"
108
109
  fails "The defined? keyword for a simple constant does not call Object.const_missing if the constant is not defined"
109
110
  fails "The defined? keyword for a simple constant returns 'constant' for a constant defined in an included module"
110
111
  fails "The defined? keyword for a simple constant returns 'constant' for an included module"
@@ -5,28 +5,123 @@ opal_filter "Numeric" do
5
5
  fails "Numeric#remainder returns the result of calling self#% with other if self and other are less than 0"
6
6
  fails "Numeric#remainder returns the result of calling self#% with other if self is 0"
7
7
  fails "Numeric#singleton_method_added raises a TypeError when trying to define a singleton method on a Numeric"
8
- fails "Numeric#step Numeric#step with [-infinity, -step] does not yield when self is -infinity"
9
- fails "Numeric#step Numeric#step with [-infinity, step] does not yield when self is -infinity"
10
- fails "Numeric#step Numeric#step with [infinity, -step] does not yield when self is -infinity"
11
- fails "Numeric#step Numeric#step with [infinity, -step] does not yield when self is +infinity"
12
- fails "Numeric#step Numeric#step with [infinity, step] does not yield when self is infinity"
13
- fails "Numeric#step Numeric#step with [stop, -infinity] does not yield when stop is Infinity"
14
- fails "Numeric#step Numeric#step with [stop, -step] when self, stop or step is a Float is careful about not yielding a value smaller than limit"
15
- fails "Numeric#step Numeric#step with [stop, +Infinity] does not yield when stop is -Infinity"
16
- fails "Numeric#step Numeric#step with [stop, +step] when self, stop or step is a Float is careful about not yielding a value greater than limit"
17
- fails "Numeric#step Numeric#step with [stop, step] when self and stop are Fixnums but step is a String raises an ArgumentError if given a block"
18
- fails "Numeric#step when no block is given returned Enumerator size raises an ArgumentError when step is 0"
19
- fails "Numeric#step when no block is given returned Enumerator size raises an ArgumentError when step is 0.0"
20
- fails "Numeric#step when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns 0 if value < limit"
21
- fails "Numeric#step when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns the difference between self and stop divided by the number of steps"
22
- fails "Numeric#step when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns 0 if value > limit"
23
- fails "Numeric#step when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns the difference between self and stop divided by the number of steps"
24
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 0 if value < limit"
25
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 1 if step is Float::INFINITY"
26
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns the difference between self and stop divided by the number of steps"
27
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 0 if value > limit"
28
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 1 if step is Float::INFINITY"
29
- fails "Numeric#step when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns the difference between self and stop divided by the number of steps"
30
- fails "Numeric#step with [stop, step] decrements self using #+ until self < stop when step < 0"
31
- fails "Numeric#step with [stop, step] increments self using #+ until self > stop when step > 0"
8
+ fails "Numeric#step with keyword arguments defaults to step = 1"
9
+ fails "Numeric#step with keyword arguments does not rescue ArgumentError exceptions"
10
+ fails "Numeric#step with keyword arguments does not rescue TypeError exceptions"
11
+ fails "Numeric#step with keyword arguments should loop over self when step is 0 or 0.0"
12
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative Infinity step yields once if self > stop"
13
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative Infinity step yields once if stop is -Infinity"
14
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative Infinity step yields once when self and stop are Infinity"
15
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative Infinity step yields once when self equals stop"
16
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative step is careful about not yielding a value smaller than limit"
17
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative step yields once when self equals stop"
18
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a negative step yields while decreasing self by step while self > stop"
19
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive Infinity step yields once if self < stop"
20
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive Infinity step yields once when self and stop are Infinity"
21
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive Infinity step yields once when self equals stop"
22
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive Infinity step yields once when stop is Infinity"
23
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive step is careful about not yielding a value greater than limit"
24
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive step yields once when self equals stop"
25
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float with a positive step yields while increasing self by step while < stop"
26
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float yields Floats even if only self is a Float"
27
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float yields Floats even if only step is a Float"
28
+ fails "Numeric#step with keyword arguments when at least one of self, stop or step is a Float yields Floats even if only stop is a Float"
29
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size should return infinity_value when step is 0"
30
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size should return infinity_value when step is 0.0"
31
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns 0 if value < limit"
32
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns the difference between self and stop divided by the number of steps"
33
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns 0 if value > limit"
34
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns the difference between self and stop divided by the number of steps"
35
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 0 if value < limit"
36
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 1 if step is infinity_value"
37
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns the difference between self and stop divided by the number of steps"
38
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 0 if value > limit"
39
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 1 if step is infinity_value"
40
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns the difference between self and stop divided by the number of steps"
41
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
42
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
43
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an when step is a numeric representation"
44
+ fails "Numeric#step with keyword arguments when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
45
+ fails "Numeric#step with keyword arguments when no block is given returns an Enumerator that uses the given step"
46
+ fails "Numeric#step with keyword arguments when self, stop and step are Fixnums with a negative step yields once when self equals stop"
47
+ fails "Numeric#step with keyword arguments when self, stop and step are Fixnums with a negative step yields while decreasing self by step until stop is reached"
48
+ fails "Numeric#step with keyword arguments when self, stop and step are Fixnums with a positive step yields once when self equals stop"
49
+ fails "Numeric#step with keyword arguments when self, stop and step are Fixnums with a positive step yields while increasing self by step until stop is reached"
50
+ fails "Numeric#step with keyword arguments when self, stop and step are Fixnums yields only Fixnums"
51
+ fails "Numeric#step with keyword arguments when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
52
+ fails "Numeric#step with keyword arguments when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
53
+ fails "Numeric#step with keyword arguments when step is a String with self and stop as Floats raises an when step is a numeric representation"
54
+ fails "Numeric#step with keyword arguments when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
55
+ fails "Numeric#step with mixed arguments should loop over self when step is 0 or 0.0"
56
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a Infinity stop and a negative step does not yield when self is negative infinity"
57
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a Infinity stop and a negative step does not yield when self is positive infinity"
58
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a Infinity stop and a positive step does not yield when self is infinity"
59
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a negative Infinity step does not yield when stop is Infinity"
60
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a negative Infinity stop and a negative step does not yield when self is negative infinity"
61
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a negative Infinity stop and a positive step does not yield when self is negative infinity"
62
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a negative step is careful about not yielding a value smaller than limit"
63
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a negative step yields while decreasing self by step while self > stop"
64
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive Infinity step does not yield when self > stop"
65
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive Infinity step does not yield when stop is -Infinity"
66
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive Infinity step yields once if self < stop"
67
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive step does not yield when self is greater than stop"
68
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive step is careful about not yielding a value greater than limit"
69
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float with a positive step yields while increasing self by step while < stop"
70
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float yields Floats even if only self is a Float"
71
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float yields Floats even if only step is a Float"
72
+ fails "Numeric#step with mixed arguments when at least one of self, stop or step is a Float yields Floats even if only stop is a Float"
73
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size should return infinity_value when step is 0"
74
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size should return infinity_value when step is 0.0"
75
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns 0 if value < limit"
76
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns the difference between self and stop divided by the number of steps"
77
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns 0 if value > limit"
78
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns the difference between self and stop divided by the number of steps"
79
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 0 if value < limit"
80
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 1 if step is infinity_value"
81
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns the difference between self and stop divided by the number of steps"
82
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 0 if value > limit"
83
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 1 if step is infinity_value"
84
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns the difference between self and stop divided by the number of steps"
85
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
86
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
87
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an when step is a numeric representation"
88
+ fails "Numeric#step with mixed arguments when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
89
+ fails "Numeric#step with mixed arguments when no block is given returns an Enumerator that uses the given step"
90
+ fails "Numeric#step with mixed arguments when self, stop and step are Fixnums with a negative step yields while decreasing self by step until stop is reached"
91
+ fails "Numeric#step with mixed arguments when self, stop and step are Fixnums with a positive step does not yield when self is greater than stop"
92
+ fails "Numeric#step with mixed arguments when self, stop and step are Fixnums with a positive step yields while increasing self by step until stop is reached"
93
+ fails "Numeric#step with mixed arguments when self, stop and step are Fixnums yields only Fixnums"
94
+ fails "Numeric#step with mixed arguments when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
95
+ fails "Numeric#step with mixed arguments when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
96
+ fails "Numeric#step with mixed arguments when step is a String with self and stop as Floats raises an when step is a numeric representation"
97
+ fails "Numeric#step with mixed arguments when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
98
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a Infinity stop and a negative step does not yield when self is negative infinity"
99
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a Infinity stop and a negative step does not yield when self is positive infinity"
100
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a Infinity stop and a positive step does not yield when self is infinity"
101
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a negative Infinity step does not yield when stop is Infinity"
102
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a negative Infinity stop and a negative step does not yield when self is negative infinity"
103
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a negative Infinity stop and a positive step does not yield when self is negative infinity"
104
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a negative step is careful about not yielding a value smaller than limit"
105
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a positive Infinity step does not yield when stop is -Infinity"
106
+ fails "Numeric#step with positional args when at least one of self, stop or step is a Float with a positive step is careful about not yielding a value greater than limit"
107
+ fails "Numeric#step with positional args when no block is given returned Enumerator size raises an ArgumentError when step is 0"
108
+ fails "Numeric#step with positional args when no block is given returned Enumerator size raises an ArgumentError when step is 0.0"
109
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns 0 if value < limit"
110
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop and step are Fixnums and step is negative returns the difference between self and stop divided by the number of steps"
111
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns 0 if value > limit"
112
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop and step are Fixnums and step is positive returns the difference between self and stop divided by the number of steps"
113
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 0 if value < limit"
114
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns 1 if step is infinity_value"
115
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is negative returns the difference between self and stop divided by the number of steps"
116
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 0 if value > limit"
117
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns 1 if step is infinity_value"
118
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when self, stop or step is a Float and step is positive returns the difference between self and stop divided by the number of steps"
119
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
120
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
121
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an when step is a numeric representation"
122
+ fails "Numeric#step with positional args when no block is given returned Enumerator size when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
123
+ fails "Numeric#step with positional args when step is a String with self and stop as Fixnums raises an when step is a numeric representation"
124
+ fails "Numeric#step with positional args when step is a String with self and stop as Fixnums raises an with step as an alphanumeric string"
125
+ fails "Numeric#step with positional args when step is a String with self and stop as Floats raises an when step is a numeric representation"
126
+ fails "Numeric#step with positional args when step is a String with self and stop as Floats raises an with step as an alphanumeric string"
32
127
  end
@@ -1,5 +1,11 @@
1
1
  opal_filter "Proc" do
2
2
  fails "Proc as an implicit block pass argument remains the same object if re-vivified by the target method"
3
+ fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a=1| }\n @b = proc { |a=1, b=2| }"
4
+ fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a: 1| }\n @b = proc { |a: 1, b: 2| }"
5
+ fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |**k, &l| }\n @b = proc { |a: 1, b: 2, **k| }"
6
+ fails "Proc#arity for instances created with proc { || } returns zero for definition \n @a = proc { |a=1, b: 2| }\n @b = proc { |a=1, b: 2| }"
7
+ fails "Proc#arity for instances created with proc { || } returns positive values for definition \n @a = proc { |a, b=1| }\n @b = proc { |a, b, c=1, d=2| }"
8
+ fails "Proc#arity for instances created with proc { || } returns positive values for definition \n @a = proc { |(a, (*b, c)), d=1| }\n @b = proc { |a, (*b, c), d, (*e), (*), **k| }"
3
9
  fails "Proc#binding returns a Binding instance"
4
10
  fails "Proc#binding returns the binding associated with self"
5
11
  fails "Proc#curry with arity argument returns Procs with arities of -1 regardless of the value of _arity_"
@@ -36,6 +36,7 @@ opal_filter "String" do
36
36
  fails "String#getbyte starts indexing at 0"
37
37
  fails "String#slice with Range calls to_int on range arguments"
38
38
  fails "String#split with Regexp includes all captures in the result array" # fails with phantomjs
39
+ fails "String#sub with pattern, replacement returns a copy of self when no modification is made"
39
40
  fails "String#to_c returns a Complex object"
40
41
  fails "String#to_c returns a complex number with 0 as the real part, 0 as the imaginary part for unrecognised Strings"
41
42
  fails "String#to_c understands 'a+bi' to mean a complex number with 'a' as the real part, 'b' as the imaginary"
@@ -1,3 +1,4 @@
1
1
  opal_filter "Struct" do
2
2
  fails "Struct#hash returns the same fixnum for structs with the same content"
3
+ fails "Struct-based class#dup retains an included module in the ancestor chain for the struct's singleton class"
3
4
  end
@@ -43,6 +43,7 @@ opal_filter "freezing" do
43
43
  fails "Module#undef_method on frozen instance raises a TypeError when passed a not name"
44
44
  fails "OpenStruct#method_missing when called with a method name ending in '=' raises a TypeError when self is frozen"
45
45
  fails "String#clone copies frozen state"
46
+ fails "String#freeze doesn't produce the same object for different instances of literals in the source"
46
47
  fails "String#initialize with no arguments does not raise an exception when frozen"
47
48
  fails "StringScanner#initialize returns an instance of StringScanner"
48
49
  fails "A singleton method definition raises RuntimeError if frozen"
@@ -15,6 +15,7 @@ opal_filter "Hash" do
15
15
  fails "Hash#compare_by_identity? returns false by default"
16
16
  fails "Hash#compare_by_identity? returns true once #compare_by_identity has been invoked on self"
17
17
  fails "Hash#compare_by_identity? returns true when called multiple times on the same ident hash"
18
+ fails "Hash#compare_by_identity does not call #hash on keys"
18
19
  fails "Hash#default= raises a RuntimeError if called on a frozen instance"
19
20
  fails "Hash#default_proc= raises a RuntimeError if self is frozen"
20
21
  fails "Hash#delete raises a RuntimeError if called on a frozen instance"
@@ -17,6 +17,8 @@ opal_filter "private" do
17
17
  fails "Module#attr_reader is a private method"
18
18
  fails "Module#attr_writer is a private method"
19
19
  fails "Module#define_method when name is not a special private name given an UnboundMethod sets the visibility of the method to the current visibility"
20
+ fails "Module#define_method when name is not a special private name given an UnboundMethod and called from the target module sets the visibility of the method to the current visibility"
21
+ fails "Module#define_method when name is not a special private name passed a block and called from the target module sets the visibility of the method to the current visibility"
20
22
  fails "Module#extend_object is a private method"
21
23
  fails "Module#extend_object is called even when private"
22
24
  fails "Module#extended is private in its default implementation"
@@ -206,6 +206,7 @@ opal_filter "String" do
206
206
  fails "String#gsub! with pattern and replacement returns nil if no modifications were made"
207
207
  fails "String#gsub! with pattern and replacement taints self if replacement is tainted"
208
208
  fails "String#gsub! with pattern and replacement untrusts self if replacement is untrusted"
209
+ fails "String#gsub! with pattern and replacement modifies self in place with multi-byte characters and returns self"
209
210
  fails "String#gsub! with pattern and without replacement and block returned Enumerator size should return nil"
210
211
  fails "String#gsub! with pattern and without replacement and block returns an enumerator"
211
212
  fails "String#index raises a TypeError if passed a Symbol"
@@ -114,7 +114,7 @@ describe "The predefined global constants" do
114
114
 
115
115
  it "includes RUBY_VERSION" do
116
116
  Object.const_defined?(:RUBY_VERSION).should == true
117
- RUBY_VERSION.should == "2.2.3"
117
+ RUBY_VERSION.should =~ /^\d\.\d\.\d$/
118
118
  end
119
119
 
120
120
  it "includes RUBY_RELEASE_DATE" do
data/stdlib/native.rb CHANGED
@@ -526,7 +526,7 @@ class Hash
526
526
 
527
527
  def initialize(defaults = undefined, &block)
528
528
  %x{
529
- if (defaults !== undefined && defaults.constructor === Object) {
529
+ if (defaults != null && defaults.constructor === Object) {
530
530
  var smap = self.$$smap,
531
531
  keys = self.$$keys,
532
532
  key, value;
data/stdlib/nodejs/dir.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  class Dir
2
2
  @__glob__ = node_require :glob
3
+ @__fs__ = node_require :fs
3
4
  `var __glob__ = #{@__glob__}`
5
+ `var __fs__ = #{@__fs__}`
4
6
 
5
7
  class << self
6
8
  def [] glob
@@ -10,6 +12,22 @@ class Dir
10
12
  def pwd
11
13
  `process.cwd()`
12
14
  end
15
+
16
+ def mkdir(path)
17
+ `__fs__.mkdirSync(#{path})`
18
+ end
19
+
20
+ def entries(dirname)
21
+ %x{
22
+ var result = [];
23
+ var entries = __fs__.readdirSync(#{dirname});
24
+ for (var i = 0; i < entries.length; i++) {
25
+ result.push(entries[i]);
26
+ }
27
+ return result;
28
+ }
29
+ end
30
+
13
31
  alias getwd pwd
14
32
  end
15
33
  end
@@ -0,0 +1 @@
1
+ require 'opal/builder'
data/stdlib/pathname.rb CHANGED
@@ -209,6 +209,10 @@ class Pathname
209
209
  Pathname.new(File.join(*relpath_names))
210
210
  end
211
211
  end
212
+
213
+ def entries
214
+ Dir.entries(@path).map {|f| self.class.new(f) }
215
+ end
212
216
  end
213
217
 
214
218
  module Kernel
data/tasks/building.rake CHANGED
@@ -19,6 +19,10 @@ task :dist do
19
19
  Opal::Config.dynamic_require_severity = :warning
20
20
  env = Opal::Environment.new
21
21
 
22
+ # Hike gem is required to build opal-builder
23
+ # Without this linen the build throws an exception: "Sprockets::FileNotFound: couldn't find file 'hike' with type 'application/javascript'"
24
+ env.use_gem 'hike'
25
+
22
26
  build_dir = ENV['DIR'] || 'build'
23
27
  files = ENV['FILES'] ? ENV['FILES'].split(',') :
24
28
  Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }
data/tasks/testing.rake CHANGED
@@ -255,6 +255,7 @@ task :test_nodejs do
255
255
  %w[
256
256
  opal-parser.rb
257
257
  test_file.rb
258
+ test_dir.rb
258
259
  ],
259
260
  includes: %w[test/nodejs],
260
261
  js_filename: js_filename,
@@ -0,0 +1,17 @@
1
+ # Copied from cruby and modified to skip unsupported syntaxes
2
+ require 'test/unit'
3
+ require 'nodejs'
4
+ require 'nodejs/dir'
5
+
6
+ class TestNodejsDir < Test::Unit::TestCase
7
+ def test_dir_entries
8
+ path = "/tmp/testing_nodejs_dir_implementation_#{Time.now.to_i}"
9
+ Dir.mkdir(path)
10
+ result = Dir.entries(path)
11
+ assert_equal(result.length, 0)
12
+ File.open(path + '/bar', "w") {}
13
+ File.open(path + '/baz', "w") {}
14
+ result = Dir.entries(path)
15
+ assert_equal(result.length, 2)
16
+ end
17
+ end
@@ -5,7 +5,7 @@ require 'nodejs/file'
5
5
 
6
6
  class TestNodejsFile < Test::Unit::TestCase
7
7
  def test_write_read
8
- path = '/tmp/testing_nodejs_file_implementation'
8
+ path = "/tmp/testing_nodejs_file_implementation_#{Time.now.to_i}"
9
9
  contents = 'foobar'
10
10
  assert !File.exist?(path)
11
11
  File.write path, contents
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.10.0.beta5
4
+ version: 0.10.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-25 00:00:00.000000000 Z
11
+ date: 2016-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sourcemap
@@ -1087,6 +1087,7 @@ files:
1087
1087
  - stdlib/nodejs/rubygems.rb
1088
1088
  - stdlib/nodejs/yaml.rb
1089
1089
  - stdlib/observer.rb
1090
+ - stdlib/opal-builder.rb
1090
1091
  - stdlib/opal-parser.rb
1091
1092
  - stdlib/opal-source-maps.rb
1092
1093
  - stdlib/opal/platform.rb
@@ -1120,6 +1121,7 @@ files:
1120
1121
  - tasks/testing.rake
1121
1122
  - tasks/testing/mspec_special_calls.rb
1122
1123
  - tasks/testing/sprockets-phantomjs.js
1124
+ - test/nodejs/test_dir.rb
1123
1125
  - test/nodejs/test_file.rb
1124
1126
  - test/opal/test_keyword.rb
1125
1127
  - test/opal/unsupported_and_bugs.rb
@@ -1536,6 +1538,7 @@ test_files:
1536
1538
  - spec/support/match_helpers.rb
1537
1539
  - spec/support/mspec_rspec_adapter.rb
1538
1540
  - spec/support/parser_helpers.rb
1541
+ - test/nodejs/test_dir.rb
1539
1542
  - test/nodejs/test_file.rb
1540
1543
  - test/opal/test_keyword.rb
1541
1544
  - test/opal/unsupported_and_bugs.rb