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 +4 -4
- data/.gitignore +2 -1
- data/CHANGELOG.md +1 -0
- data/lib/opal/cli_runners/server.rb +1 -1
- data/lib/opal/nodes/iter.rb +1 -0
- data/lib/opal/sprockets/processor.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array.rb +8 -0
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/enumerable.rb +12 -21
- data/spec/filters/bugs/basicobject.rb +1 -0
- data/spec/filters/bugs/kernel.rb +1 -0
- data/spec/filters/bugs/language.rb +1 -0
- data/spec/filters/bugs/numeric.rb +119 -24
- data/spec/filters/bugs/proc.rb +6 -0
- data/spec/filters/bugs/string.rb +1 -0
- data/spec/filters/bugs/struct.rb +1 -0
- data/spec/filters/unsupported/freeze.rb +1 -0
- data/spec/filters/unsupported/hash.rb +1 -0
- data/spec/filters/unsupported/privacy.rb +2 -0
- data/spec/filters/unsupported/string.rb +1 -0
- data/spec/opal/core/language/predefined_spec.rb +1 -1
- data/stdlib/native.rb +1 -1
- data/stdlib/nodejs/dir.rb +18 -0
- data/stdlib/opal-builder.rb +1 -0
- data/stdlib/pathname.rb +4 -0
- data/tasks/building.rake +4 -0
- data/tasks/testing.rake +1 -0
- data/test/nodejs/test_dir.rb +17 -0
- data/test/nodejs/test_file.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2a873c45ca2ab2562848657e97a18d95d7891fe
|
4
|
+
data.tar.gz: 21c65698f96153b278c4353b86d629277a0da384
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efb186e9bf8740c1576320ab79f3ee52a75fdaed4700e5e4bd802c3ecf535cdd181a081bdd792002c829f7618448e34caef000a32b1fb4b31ae47ce942875cb9
|
7
|
+
data.tar.gz: de65d4412a33c2faf634be26390a48c598cfd1a413420929b01f5e46e8c34a85daa70fc03f1fb2552506b315a8f32479b89f19dcc5e1709874e26d57aec462c1
|
data/.gitignore
CHANGED
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
|
data/lib/opal/nodes/iter.rb
CHANGED
@@ -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
data/opal/corelib/array.rb
CHANGED
data/opal/corelib/constants.rb
CHANGED
@@ -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.
|
5
|
-
RUBY_RELEASE_DATE = '
|
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'
|
data/opal/corelib/enumerable.rb
CHANGED
@@ -112,30 +112,21 @@ module Enumerable
|
|
112
112
|
end
|
113
113
|
|
114
114
|
def count(object = undefined, &block)
|
115
|
-
|
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
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
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
|
-
|
125
|
+
each do |*args|
|
126
|
+
`result++` if `Opal.yieldX(block, args)`
|
127
|
+
end
|
136
128
|
|
137
|
-
|
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"
|
data/spec/filters/bugs/kernel.rb
CHANGED
@@ -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
|
9
|
-
fails "Numeric#step
|
10
|
-
fails "Numeric#step
|
11
|
-
fails "Numeric#step
|
12
|
-
fails "Numeric#step
|
13
|
-
fails "Numeric#step
|
14
|
-
fails "Numeric#step
|
15
|
-
fails "Numeric#step
|
16
|
-
fails "Numeric#step
|
17
|
-
fails "Numeric#step
|
18
|
-
fails "Numeric#step when
|
19
|
-
fails "Numeric#step when
|
20
|
-
fails "Numeric#step
|
21
|
-
fails "Numeric#step
|
22
|
-
fails "Numeric#step
|
23
|
-
fails "Numeric#step
|
24
|
-
fails "Numeric#step
|
25
|
-
fails "Numeric#step
|
26
|
-
fails "Numeric#step
|
27
|
-
fails "Numeric#step
|
28
|
-
fails "Numeric#step
|
29
|
-
fails "Numeric#step when no block is given returned Enumerator size
|
30
|
-
fails "Numeric#step with
|
31
|
-
fails "Numeric#step with
|
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
|
data/spec/filters/bugs/proc.rb
CHANGED
@@ -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_"
|
data/spec/filters/bugs/string.rb
CHANGED
@@ -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"
|
data/spec/filters/bugs/struct.rb
CHANGED
@@ -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
|
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
|
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
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
@@ -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
|
data/test/nodejs/test_file.rb
CHANGED
@@ -5,7 +5,7 @@ require 'nodejs/file'
|
|
5
5
|
|
6
6
|
class TestNodejsFile < Test::Unit::TestCase
|
7
7
|
def test_write_read
|
8
|
-
path =
|
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.
|
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-
|
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
|