opal 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitmodules +27 -3
- data/.rspec +1 -1
- data/CHANGELOG.md +29 -5
- data/README.md +30 -3
- data/Rakefile +18 -9
- data/bin/opal +1 -1
- data/bin/opal-build +70 -7
- data/lib/mspec/opal/rake_task.rb +6 -9
- data/lib/opal/cli.rb +2 -2
- data/lib/opal/nodes/call.rb +1 -1
- data/lib/opal/nodes/def.rb +1 -1
- data/lib/opal/nodes/rescue.rb +19 -18
- data/lib/opal/parser/grammar.rb +8 -3
- data/lib/opal/parser/grammar.y +4 -0
- data/lib/opal/parser/lexer.rb +10 -5
- data/lib/opal/sprockets/environment.rb +9 -0
- data/lib/opal/sprockets/erb.rb +9 -1
- data/lib/opal/sprockets/processor.rb +10 -14
- data/lib/opal/util.rb +50 -15
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +4 -4
- data/opal/corelib/enumerable.rb +1 -1
- data/opal/corelib/enumerator.rb +7 -3
- data/opal/corelib/hash.rb +38 -14
- data/opal/corelib/kernel.rb +6 -2
- data/opal/corelib/module.rb +15 -1
- data/opal/corelib/runtime.js +32 -2
- data/opal/corelib/string.rb +103 -53
- data/opal/corelib/variables.rb +3 -3
- data/spec/cli/fixtures/sprockets_file.js.rb +3 -0
- data/spec/cli/parser/literal_spec.rb +5 -0
- data/spec/cli/sprockets/environment_spec.rb +14 -0
- data/spec/cli/sprockets/erb_spec.rb +25 -0
- data/spec/cli/sprockets/processor_spec.rb +28 -0
- data/spec/{opal/filters → filters}/bugs/array.rb +29 -9
- data/spec/{opal/filters → filters}/bugs/basic_object.rb +2 -0
- data/spec/{opal/filters → filters}/bugs/class.rb +1 -0
- data/spec/{opal/filters → filters}/bugs/enumerable.rb +6 -2
- data/spec/filters/bugs/enumerator.rb +3 -0
- data/spec/{opal/filters → filters}/bugs/hash.rb +6 -24
- data/spec/{opal/filters → filters}/bugs/kernel.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/language.rb +14 -3
- data/spec/{opal/filters → filters}/bugs/math.rb +3 -1
- data/spec/{opal/filters → filters}/bugs/module.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/nil.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/numeric.rb +1 -1
- data/spec/{opal/filters → filters}/bugs/opal.rb +0 -0
- data/spec/filters/bugs/regexp.rb +7 -0
- data/spec/{opal/filters → filters}/bugs/set.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/singleton.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/string.rb +40 -13
- data/spec/{opal/filters → filters}/bugs/stringscanner.rb +1 -0
- data/spec/{opal/filters → filters}/bugs/struct.rb +7 -2
- data/spec/{opal/filters → filters}/bugs/symbol.rb +0 -0
- data/spec/{opal/filters → filters}/bugs/time.rb +23 -0
- data/spec/{opal/filters → filters}/bugs/unknown.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/encoding.rb +34 -1
- data/spec/{opal/filters → filters}/unsupported/enumerator.rb +1 -0
- data/spec/{opal/filters → filters}/unsupported/float.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/frozen.rb +3 -2
- data/spec/{opal/filters → filters}/unsupported/hash_compare_by_identity.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/integer_size.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/method_added.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/mutable_strings.rb +14 -0
- data/spec/{opal/filters → filters}/unsupported/private_constants.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/private_methods.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/random.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/ruby_exe.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/tainted.rb +11 -0
- data/spec/{opal/filters → filters}/unsupported/time.rb +0 -0
- data/spec/{opal/filters → filters}/unsupported/trusted.rb +14 -0
- data/spec/opal/core/kernel/methods_spec.rb +16 -2
- data/spec/opal/core/language/string_spec.rb +29 -1
- data/spec/opal/core/module/remove_const_spec.rb +1 -1
- data/spec/opal/stdlib/erb/erb_spec.rb +3 -3
- data/spec/opal/stdlib/native/native_reader_spec.rb +22 -0
- data/spec/opal/stdlib/native/native_writer_spec.rb +30 -0
- data/spec/rubyspecs +285 -0
- data/spec/{opal/spec_helper.rb → spec_helper.rb} +0 -0
- data/stdlib/native.rb +21 -0
- data/stdlib/opal-parser.rb +14 -3
- data/stdlib/promise.rb +2 -2
- metadata +113 -97
- data/spec/opal/filters/bugs/regexp.rb +0 -5
- data/spec/opal/rubyspecs +0 -285
|
File without changes
|
|
@@ -3,6 +3,10 @@ opal_filter "Encoding" do
|
|
|
3
3
|
fails "Array#inspect use US-ASCII encoding if the default external encoding is not ascii compatible"
|
|
4
4
|
fails "Array#inspect use the default external encoding if it is ascii compatible"
|
|
5
5
|
fails "Array#inspect returns a US-ASCII string for an empty Array"
|
|
6
|
+
fails "Array#inspect with encoding returns a US-ASCII string for an empty Array"
|
|
7
|
+
fails "Array#inspect with encoding use the default external encoding if it is ascii compatible"
|
|
8
|
+
fails "Array#inspect with encoding use US-ASCII encoding if the default external encoding is not ascii compatible"
|
|
9
|
+
fails "Array#inspect with encoding raises if inspected result is not default external encoding"
|
|
6
10
|
|
|
7
11
|
fails "Array#join fails for arrays with incompatibly-encoded strings"
|
|
8
12
|
fails "Array#join uses the widest common encoding when other strings are incompatible"
|
|
@@ -10,14 +14,29 @@ opal_filter "Encoding" do
|
|
|
10
14
|
fails "Array#join returns a US-ASCII string for an empty Array"
|
|
11
15
|
|
|
12
16
|
fails "Array#to_s raises if inspected result is not default external encoding"
|
|
17
|
+
fails "Array#to_s returns a US-ASCII string for an empty Array"
|
|
13
18
|
fails "Array#to_s use US-ASCII encoding if the default external encoding is not ascii compatible"
|
|
14
19
|
fails "Array#to_s use the default external encoding if it is ascii compatible"
|
|
15
|
-
fails "Array#to_s
|
|
20
|
+
fails "Array#to_s with encoding raises if inspected result is not default external encoding"
|
|
21
|
+
fails "Array#to_s with encoding returns a US-ASCII string for an empty Array"
|
|
22
|
+
fails "Array#to_s with encoding use US-ASCII encoding if the default external encoding is not ascii compatible"
|
|
23
|
+
fails "Array#to_s with encoding use the default external encoding if it is ascii compatible"
|
|
24
|
+
|
|
25
|
+
fails "String#== ignores encoding difference of compatible string"
|
|
26
|
+
fails "String#== considers encoding difference of incompatible string"
|
|
27
|
+
fails "String#== considers encoding compatibility"
|
|
28
|
+
|
|
29
|
+
fails "String#=== ignores encoding difference of compatible string"
|
|
30
|
+
fails "String#=== considers encoding difference of incompatible string"
|
|
31
|
+
fails "String#=== considers encoding compatibility"
|
|
16
32
|
|
|
17
33
|
fails "String#<=> with String returns -1 if self is bytewise less than other"
|
|
18
34
|
fails "String#<=> with String returns 1 if self is bytewise greater than other"
|
|
19
35
|
fails "String#<=> with String returns 0 if self and other contain identical ASCII-compatible bytes in different encodings"
|
|
36
|
+
fails "String#<=> with String returns 0 with identical ASCII-compatible bytes of different encodings"
|
|
20
37
|
fails "String#<=> with String does not return 0 if self and other contain identical non-ASCII-compatible bytes in different encodings"
|
|
38
|
+
fails "String#<=> with String compares the indices of the encodings when the strings have identical non-ASCII-compatible bytes"
|
|
39
|
+
fails "String#<=> with String ignores encoding difference"
|
|
21
40
|
|
|
22
41
|
fails "String.allocate returns a fully-formed String"
|
|
23
42
|
fails "String.allocate returns a binary String"
|
|
@@ -26,19 +45,33 @@ opal_filter "Encoding" do
|
|
|
26
45
|
|
|
27
46
|
fails "String#chars is unicode aware"
|
|
28
47
|
|
|
48
|
+
fails "String#count returns the number of occurrences of a multi-byte character"
|
|
49
|
+
|
|
29
50
|
fails "String#downcase is locale insensitive (only replaces A-Z)"
|
|
30
51
|
|
|
31
52
|
fails "String#each_char is unicode aware"
|
|
32
53
|
|
|
54
|
+
fails "String#eql? ignores encoding difference of compatible string"
|
|
55
|
+
fails "String#eql? considers encoding difference of incompatible string"
|
|
56
|
+
fails "String#eql? considers encoding compatibility"
|
|
57
|
+
|
|
33
58
|
fails "String#gsub with pattern and block uses the compatible encoding if they are compatible"
|
|
34
59
|
fails "String#gsub with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible"
|
|
35
60
|
fails "String#gsub with pattern and block replaces the incompatible part properly even if the encodings are not compatible"
|
|
36
61
|
|
|
62
|
+
fails "String#initialize with an argument carries over the encoding invalidity"
|
|
63
|
+
|
|
64
|
+
fails "String#replace carries over the encoding invalidity"
|
|
65
|
+
|
|
37
66
|
fails "String#split with Regexp retains the encoding of the source string"
|
|
38
67
|
fails "String#split with Regexp returns an ArgumentError if an invalid UTF-8 string is supplied"
|
|
68
|
+
fails "String#split with Regexp respects the encoding of the regexp when splitting between characters"
|
|
69
|
+
fails "String#split with Regexp splits a string on each character for a multibyte encoding and empty split"
|
|
39
70
|
|
|
40
71
|
fails "String#upcase is locale insensitive (only replaces a-z)"
|
|
41
72
|
|
|
73
|
+
fails "The defined? keyword for pseudo-variables returns 'expression' for __ENCODING__"
|
|
74
|
+
|
|
42
75
|
# language/magic_comment_spec
|
|
43
76
|
fails "Magic comment can take vim style"
|
|
44
77
|
fails "Magic comment can take Emacs style"
|
|
@@ -10,4 +10,5 @@ opal_filter "Enumerator as generator" do
|
|
|
10
10
|
fails "Enumerator#rewind does nothing if the object doesn't have a #rewind method"
|
|
11
11
|
fails "Enumerator#rewind works with peek to reset the position"
|
|
12
12
|
fails "Enumerator#rewind calls the enclosed object's rewind method if one exists"
|
|
13
|
+
fails "Enumerator#rewind clears a pending #feed value"
|
|
13
14
|
end
|
|
File without changes
|
|
@@ -60,16 +60,17 @@ opal_filter "Object#frozen" do
|
|
|
60
60
|
fails "Array#initialize_copy raises a RuntimeError on a frozen array"
|
|
61
61
|
|
|
62
62
|
fails "Hash#clear raises a RuntimeError if called on a frozen instance"
|
|
63
|
+
fails "Hash#default_proc= raises a RuntimeError if self is frozen"
|
|
63
64
|
fails "Hash#initialize_copy raises a RuntimeError if called on a frozen instance that would not be modified"
|
|
64
65
|
fails "Hash#initialize_copy raises a RuntimeError if called on a frozen instance that is modified"
|
|
65
66
|
fails "Hash#initialize raises a RuntimeError if called on a frozen instance"
|
|
66
67
|
fails "Hash#store raises a RuntimeError if called on a frozen instance"
|
|
67
68
|
fails "Hash#store duplicates and freezes string keys"
|
|
68
69
|
fails "Hash#default= raises a RuntimeError if called on a frozen instance"
|
|
69
|
-
fails "Hash#delete_if raises an RuntimeError if called on a frozen instance"
|
|
70
70
|
fails "Hash#delete raises a RuntimeError if called on a frozen instance"
|
|
71
|
+
fails "Hash#delete_if raises a RuntimeError if called on a frozen instance"
|
|
71
72
|
fails "Hash#[]= raises a RuntimeError if called on a frozen instance"
|
|
72
|
-
fails "Hash#keep_if raises
|
|
73
|
+
fails "Hash#keep_if raises a RuntimeError if called on a frozen instance"
|
|
73
74
|
fails "Hash#merge! raises a RuntimeError on a frozen instance that is modified"
|
|
74
75
|
fails "Hash#merge! checks frozen status before coercing an object with #to_hash"
|
|
75
76
|
fails "Hash#merge! raises a RuntimeError on a frozen instance that would not be modified"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -257,6 +257,20 @@ opal_filter "Mutable strings are not supported in Opal" do
|
|
|
257
257
|
fails "String#sub! with pattern and block returns nil if no modifications were made"
|
|
258
258
|
fails "String#sub! with pattern and block raises a RuntimeError if the string is modified while substituting"
|
|
259
259
|
fails "String#sub! with pattern and block raises a RuntimeError when self is frozen"
|
|
260
|
+
fails "String#sub! with pattern and Hash returns self with the first occurrence of pattern replaced with the value of the corresponding hash key"
|
|
261
|
+
fails "String#sub! with pattern and Hash removes keys that don't correspond to matches"
|
|
262
|
+
fails "String#sub! with pattern and Hash ignores non-String keys"
|
|
263
|
+
fails "String#sub! with pattern and Hash uses a key's value only a single time"
|
|
264
|
+
fails "String#sub! with pattern and Hash uses the hash's default value for missing keys"
|
|
265
|
+
fails "String#sub! with pattern and Hash coerces the hash values with #to_s"
|
|
266
|
+
fails "String#sub! with pattern and Hash coerces the hash values with #to_s"
|
|
267
|
+
fails "String#sub! with pattern and Hash uses the hash's value set from default_proc for missing keys"
|
|
268
|
+
fails "String#sub! with pattern and Hash sets $~ to MatchData of first match and nil when there's none for access from outside"
|
|
269
|
+
fails "String#sub! with pattern and Hash doesn't interpolate special sequences like \\1 for the block's return value"
|
|
270
|
+
fails "String#sub! with pattern and Hash keeps untrusted state"
|
|
271
|
+
fails "String#sub! with pattern and Hash untrusts self if a hash value is untrusted"
|
|
272
|
+
fails "String#sub! with pattern and Hash keeps tainted state"
|
|
273
|
+
fails "String#sub! with pattern and Hash taints self if a hash value is tainted"
|
|
260
274
|
|
|
261
275
|
fails "String#succ! is equivalent to succ, but modifies self in place (still returns self)"
|
|
262
276
|
fails "String#succ! raises a RuntimeError if self is frozen"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -35,6 +35,8 @@ opal_filter 'tainted' do
|
|
|
35
35
|
|
|
36
36
|
fails "Array#dup copies taint status from the original"
|
|
37
37
|
|
|
38
|
+
fails "Array#flatten returns a tainted array if self is tainted"
|
|
39
|
+
|
|
38
40
|
fails "Array#inspect taints the result if an element is tainted"
|
|
39
41
|
fails "Array#inspect does not taint the result if the Array is tainted but empty"
|
|
40
42
|
fails "Array#inspect taints the result if the Array is non-empty and tainted"
|
|
@@ -61,6 +63,9 @@ opal_filter 'tainted' do
|
|
|
61
63
|
fails "Array#to_s taints the result if the Array is non-empty and tainted"
|
|
62
64
|
|
|
63
65
|
fails "Hash#reject taints the resulting hash"
|
|
66
|
+
fails "Hash#to_a returns a tainted array if self is tainted"
|
|
67
|
+
fails "Hash#to_s returns a tainted string if self is tainted and not empty"
|
|
68
|
+
fails "Hash#inspect returns a tainted string if self is tainted and not empty"
|
|
64
69
|
|
|
65
70
|
fails "String#[] with index, length always taints resulting strings when self is tainted"
|
|
66
71
|
fails "String#[] with Range always taints resulting strings when self is tainted"
|
|
@@ -141,4 +146,10 @@ opal_filter 'tainted' do
|
|
|
141
146
|
fails "String#upcase taints result when self is tainted"
|
|
142
147
|
|
|
143
148
|
fails "Pathname.new is tainted if path is tainted"
|
|
149
|
+
|
|
150
|
+
fails "Enumerable#entries returns a tainted array if self is tainted"
|
|
151
|
+
|
|
152
|
+
fails "Enumerable#group_by returns a tainted hash if self is tainted"
|
|
153
|
+
|
|
154
|
+
fails "Enumerable#to_a returns a tainted array if self is tainted"
|
|
144
155
|
end
|
|
File without changes
|
|
@@ -34,6 +34,8 @@ opal_filter "Object#trusted/untrusted" do
|
|
|
34
34
|
|
|
35
35
|
fails "Array#dup copies untrusted status from the original"
|
|
36
36
|
|
|
37
|
+
fails "Array#flatten returns an untrusted array if self is untrusted"
|
|
38
|
+
|
|
37
39
|
fails "Array#inspect untrusts the result if an element is untrusted"
|
|
38
40
|
fails "Array#inspect does not untrust the result if the Array is untrusted but empty"
|
|
39
41
|
fails "Array#inspect untrusts the result if the Array is untrusted"
|
|
@@ -57,6 +59,18 @@ opal_filter "Object#trusted/untrusted" do
|
|
|
57
59
|
fails "Array#to_s does not untrust the result if the Array is untrusted but empty"
|
|
58
60
|
fails "Array#to_s untrusts the result if the Array is untrusted"
|
|
59
61
|
|
|
62
|
+
fails "Enumerable#to_a returns an untrusted array if self is untrusted"
|
|
63
|
+
|
|
64
|
+
fails "Enumerable#entries returns an untrusted array if self is untrusted"
|
|
65
|
+
|
|
66
|
+
fails "Enumerable#group_by returns an untrusted hash if self is untrusted"
|
|
67
|
+
|
|
68
|
+
fails "Hash#inspect returns an untrusted string if self is untrusted and not empty"
|
|
69
|
+
|
|
70
|
+
fails "Hash#to_a returns an untrusted array if self is untrusted"
|
|
71
|
+
|
|
72
|
+
fails "Hash#to_s returns an untrusted string if self is untrusted and not empty"
|
|
73
|
+
|
|
60
74
|
fails "String#chop untrusts result when self is untrusted"
|
|
61
75
|
|
|
62
76
|
fails "String#gsub with pattern and replacement untrusts the result if the original string or replacement is untrusted"
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
+
module MethodsSpecs
|
|
2
|
+
class Issue < Object
|
|
3
|
+
def unique_method_name
|
|
4
|
+
end
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# Trigger stub generation
|
|
8
|
+
Issue.new.unique_method_name
|
|
9
|
+
end
|
|
10
|
+
|
|
1
11
|
describe "Kernel#methods" do
|
|
2
12
|
it "lists methods available on an object" do
|
|
3
13
|
Object.new.methods.include?("puts").should == true
|
|
4
14
|
end
|
|
5
|
-
|
|
15
|
+
|
|
6
16
|
it "lists only singleton methods if false is passed" do
|
|
7
17
|
o = Object.new
|
|
8
18
|
def o.foo; 123; end
|
|
9
19
|
o.methods(false).should == ["foo"]
|
|
10
20
|
end
|
|
11
|
-
|
|
21
|
+
|
|
22
|
+
it "ignores stub methods" do
|
|
23
|
+
Object.methods.include?(:unique_method_name).should be_false
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -13,4 +13,32 @@ describe "Ruby character strings" do
|
|
|
13
13
|
a = 1
|
|
14
14
|
%[#{a}23].should == "123"
|
|
15
15
|
end
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
it "should not process escape characters in single-quoted heredocs" do
|
|
18
|
+
s = <<'EOD'
|
|
19
|
+
hey\now\brown\cow
|
|
20
|
+
EOD
|
|
21
|
+
s.strip.should == 'hey\now\brown\cow'
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "should ignore single-quote escapes in single-quoted heredocs" do
|
|
25
|
+
s = <<'EOD'
|
|
26
|
+
they\'re greeeeaaat!
|
|
27
|
+
EOD
|
|
28
|
+
s.strip.should == 'they\\\'re greeeeaaat!'
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "should process escape characters in double quoted heredocs" do
|
|
32
|
+
s = <<"EOD"
|
|
33
|
+
hey\now\brown\cow
|
|
34
|
+
EOD
|
|
35
|
+
s.strip.should == "hey\now\brown\cow"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should treat bare-word heredoc identifiers as double-quoted" do
|
|
39
|
+
s = <<EOD
|
|
40
|
+
hey\now\brown\cow
|
|
41
|
+
EOD
|
|
42
|
+
s.strip.should == "hey\now\brown\cow"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -6,9 +6,9 @@ require File.expand_path('../inline_block', __FILE__)
|
|
|
6
6
|
|
|
7
7
|
describe "ERB files" do
|
|
8
8
|
before :each do
|
|
9
|
-
@simple = Template['stdlib/erb/simple']
|
|
10
|
-
@quoted = Template['stdlib/erb/quoted']
|
|
11
|
-
@inline_block = Template['stdlib/erb/inline_block']
|
|
9
|
+
@simple = Template['opal/stdlib/erb/simple']
|
|
10
|
+
@quoted = Template['opal/stdlib/erb/quoted']
|
|
11
|
+
@inline_block = Template['opal/stdlib/erb/inline_block']
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it "should be defined by their filename on Template namespace" do
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'native'
|
|
2
|
+
|
|
3
|
+
describe "Native.native_reader" do
|
|
4
|
+
it "refers to an attribute on @native" do
|
|
5
|
+
Class.new {
|
|
6
|
+
include Native
|
|
7
|
+
|
|
8
|
+
native_reader :a
|
|
9
|
+
}.new(`{ a: 2 }`).a.should == 2
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it "uses multiple names" do
|
|
13
|
+
n = Class.new {
|
|
14
|
+
include Native
|
|
15
|
+
|
|
16
|
+
native_reader :a, :b
|
|
17
|
+
}.new(`{ a: 2, b: 3 }`)
|
|
18
|
+
|
|
19
|
+
n.a.should == 2
|
|
20
|
+
n.b.should == 3
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require 'native'
|
|
2
|
+
|
|
3
|
+
describe "Native.native_writer" do
|
|
4
|
+
it "refers to an attribute on @native" do
|
|
5
|
+
n = Class.new {
|
|
6
|
+
include Native
|
|
7
|
+
|
|
8
|
+
native_reader :a
|
|
9
|
+
native_writer :a
|
|
10
|
+
}.new(`{ a: 2 }`)
|
|
11
|
+
|
|
12
|
+
n.a = 4
|
|
13
|
+
n.a.should == 4
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it "supports multiple names" do
|
|
17
|
+
n = Class.new {
|
|
18
|
+
include Native
|
|
19
|
+
|
|
20
|
+
native_reader :a, :b
|
|
21
|
+
native_writer :a, :b
|
|
22
|
+
}.new(`{ a: 2, b: 3 }`)
|
|
23
|
+
|
|
24
|
+
n.a = 4
|
|
25
|
+
n.b = 5
|
|
26
|
+
|
|
27
|
+
n.a.should == 4
|
|
28
|
+
n.b.should == 5
|
|
29
|
+
end
|
|
30
|
+
end
|
data/spec/rubyspecs
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# all spec files inside these directories are loaded (matching *_spec.rb)
|
|
2
|
+
corelib/core/array
|
|
3
|
+
corelib/core/basicobject
|
|
4
|
+
corelib/core/class
|
|
5
|
+
corelib/core/comparable
|
|
6
|
+
corelib/core/enumerable
|
|
7
|
+
corelib/core/false
|
|
8
|
+
corelib/core/hash
|
|
9
|
+
corelib/core/nil
|
|
10
|
+
corelib/core/struct
|
|
11
|
+
corelib/core/true
|
|
12
|
+
corelib/core/math
|
|
13
|
+
|
|
14
|
+
corelib/core/fixnum/abs_spec
|
|
15
|
+
corelib/core/fixnum/case_compare_spec
|
|
16
|
+
corelib/core/fixnum/comparison_spec
|
|
17
|
+
corelib/core/fixnum/equal_value_spec
|
|
18
|
+
corelib/core/fixnum/element_reference_spec
|
|
19
|
+
corelib/core/fixnum/even_spec
|
|
20
|
+
corelib/core/fixnum/gt_spec
|
|
21
|
+
corelib/core/fixnum/gte_spec
|
|
22
|
+
corelib/core/fixnum/left_shift_spec
|
|
23
|
+
corelib/core/fixnum/lt_spec
|
|
24
|
+
corelib/core/fixnum/lte_spec
|
|
25
|
+
corelib/core/fixnum/magnitude_spec
|
|
26
|
+
corelib/core/fixnum/minus_spec
|
|
27
|
+
corelib/core/fixnum/odd_spec
|
|
28
|
+
corelib/core/fixnum/plus_spec
|
|
29
|
+
corelib/core/fixnum/to_s_spec
|
|
30
|
+
corelib/core/fixnum/zero_spec
|
|
31
|
+
|
|
32
|
+
corelib/core/integer/downto_spec
|
|
33
|
+
|
|
34
|
+
corelib/core/enumerator/each_spec
|
|
35
|
+
corelib/core/enumerator/new_spec
|
|
36
|
+
corelib/core/enumerator/next_spec
|
|
37
|
+
corelib/core/enumerator/rewind_spec
|
|
38
|
+
|
|
39
|
+
corelib/core/kernel/comparison_spec
|
|
40
|
+
corelib/core/kernel/eql_spec
|
|
41
|
+
corelib/core/kernel/equal_spec
|
|
42
|
+
corelib/core/kernel/equal_value_spec
|
|
43
|
+
corelib/core/kernel/tap_spec
|
|
44
|
+
corelib/core/kernel/to_s_spec
|
|
45
|
+
|
|
46
|
+
corelib/core/matchdata/to_a_spec
|
|
47
|
+
|
|
48
|
+
corelib/core/range/begin_spec
|
|
49
|
+
corelib/core/range/end_spec
|
|
50
|
+
|
|
51
|
+
corelib/core/string/allocate_spec
|
|
52
|
+
corelib/core/string/append_spec
|
|
53
|
+
corelib/core/string/ascii_only_spec
|
|
54
|
+
corelib/core/string/bytes_spec
|
|
55
|
+
corelib/core/string/bytesize_spec
|
|
56
|
+
# corelib/core/string/byteslice_spec - invalid regexp
|
|
57
|
+
corelib/core/string/capitalize_spec
|
|
58
|
+
corelib/core/string/case_compare_spec
|
|
59
|
+
corelib/core/string/casecmp_spec
|
|
60
|
+
corelib/core/string/center_spec
|
|
61
|
+
corelib/core/string/chars_spec
|
|
62
|
+
corelib/core/string/chomp_spec
|
|
63
|
+
corelib/core/string/chop_spec
|
|
64
|
+
corelib/core/string/chr_spec
|
|
65
|
+
corelib/core/string/clear_spec
|
|
66
|
+
corelib/core/string/codepoints_spec
|
|
67
|
+
corelib/core/string/comparison_spec
|
|
68
|
+
corelib/core/string/concat_spec
|
|
69
|
+
corelib/core/string/count_spec
|
|
70
|
+
# corelib/core/string/crypt_spec - not supported (can add these)
|
|
71
|
+
corelib/core/string/delete_spec
|
|
72
|
+
corelib/core/string/downcase_spec
|
|
73
|
+
# corelib/core/string/dump_spec - parse error on "\\x05"
|
|
74
|
+
corelib/core/string/dup_spec
|
|
75
|
+
corelib/core/string/each_byte_spec
|
|
76
|
+
corelib/core/string/each_char_spec
|
|
77
|
+
corelib/core/string/each_codepoint_spec
|
|
78
|
+
corelib/core/string/each_line_spec
|
|
79
|
+
corelib/core/string/each_spec
|
|
80
|
+
# corelib/core/string/element_reference_spec - fails to find a shared group - "String#[] with Regexp"
|
|
81
|
+
corelib/core/string/element_set_spec
|
|
82
|
+
corelib/core/string/empty_spec
|
|
83
|
+
corelib/core/string/encode_spec
|
|
84
|
+
corelib/core/string/encoding_spec
|
|
85
|
+
corelib/core/string/end_with_spec
|
|
86
|
+
corelib/core/string/entries_spec
|
|
87
|
+
corelib/core/string/eql_spec
|
|
88
|
+
corelib/core/string/equal_value_spec
|
|
89
|
+
corelib/core/string/force_encoding_spec
|
|
90
|
+
# corelib/core/string/getbyte_spec - parse error - "UTF-8 (\u{9865}} characters and hex escapes (\xDE)"
|
|
91
|
+
# corelib/core/string/gsub_spec - invalid regular expression
|
|
92
|
+
corelib/core/string/hash_spec
|
|
93
|
+
corelib/core/string/hex_spec
|
|
94
|
+
corelib/core/string/include_spec
|
|
95
|
+
corelib/core/string/index_spec
|
|
96
|
+
corelib/core/string/initialize_spec
|
|
97
|
+
corelib/core/string/insert_spec
|
|
98
|
+
# corelib/core/string/inspect_spec - Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT
|
|
99
|
+
corelib/core/string/intern_spec
|
|
100
|
+
corelib/core/string/length_spec
|
|
101
|
+
corelib/core/string/lines_spec
|
|
102
|
+
corelib/core/string/ljust_spec
|
|
103
|
+
corelib/core/string/lstrip_spec
|
|
104
|
+
#core/string/match_spec - fails to find a shared group
|
|
105
|
+
# corelib/core/string/modulo_spec - lots of failing specs
|
|
106
|
+
corelib/core/string/multiply_spec
|
|
107
|
+
corelib/core/string/new_spec
|
|
108
|
+
corelib/core/string/next_spec
|
|
109
|
+
# # corelib/core/string/oct_spec - parse error on -01234
|
|
110
|
+
corelib/core/string/ord_spec
|
|
111
|
+
corelib/core/string/partition_spec
|
|
112
|
+
corelib/core/string/plus_spec
|
|
113
|
+
corelib/core/string/prepend_spec
|
|
114
|
+
corelib/core/string/replace_spec
|
|
115
|
+
corelib/core/string/reverse_spec
|
|
116
|
+
corelib/core/string/rindex_spec
|
|
117
|
+
corelib/core/string/rjust_spec
|
|
118
|
+
corelib/core/string/rpartition_spec
|
|
119
|
+
corelib/core/string/rstrip_spec
|
|
120
|
+
# corelib/core/string/scan_spec - infinite loop on parsing
|
|
121
|
+
corelib/core/string/setbyte_spec
|
|
122
|
+
corelib/core/string/size_spec
|
|
123
|
+
# corelib/core/string/slice_spec - fails to find a shared thing (same as element_reference_spec)
|
|
124
|
+
corelib/core/string/split_spec
|
|
125
|
+
corelib/core/string/squeeze_spec
|
|
126
|
+
corelib/core/string/start_with_spec
|
|
127
|
+
corelib/core/string/strip_spec
|
|
128
|
+
corelib/core/string/sub_spec
|
|
129
|
+
corelib/core/string/succ_spec
|
|
130
|
+
corelib/core/string/sum_spec
|
|
131
|
+
corelib/core/string/swapcase_spec
|
|
132
|
+
corelib/core/string/to_a_spec
|
|
133
|
+
# corelib/core/string/to_c_spec - lots of failing specs
|
|
134
|
+
corelib/core/string/to_f_spec
|
|
135
|
+
# corelib/core/string/to_i_spec
|
|
136
|
+
# corelib/core/string/to_r_spec
|
|
137
|
+
corelib/core/string/to_str_spec
|
|
138
|
+
corelib/core/string/to_sym_spec
|
|
139
|
+
corelib/core/string/to_s_spec
|
|
140
|
+
corelib/core/string/tr_s_spec
|
|
141
|
+
corelib/core/string/tr_spec
|
|
142
|
+
# corelib/core/string/try_convert_spec
|
|
143
|
+
corelib/core/string/upcase_spec
|
|
144
|
+
corelib/core/string/upto_spec
|
|
145
|
+
corelib/core/string/valid_encoding_spec
|
|
146
|
+
|
|
147
|
+
corelib/core/symbol/to_proc_spec
|
|
148
|
+
|
|
149
|
+
corelib/core/time/asctime_spec
|
|
150
|
+
corelib/core/time/at_spec
|
|
151
|
+
corelib/core/time/ctime_spec
|
|
152
|
+
corelib/core/time/day_spec
|
|
153
|
+
corelib/core/time/eql_spec
|
|
154
|
+
corelib/core/time/friday_spec
|
|
155
|
+
corelib/core/time/getgm_spec
|
|
156
|
+
corelib/core/time/gm_spec
|
|
157
|
+
corelib/core/time/gmt_offset_spec
|
|
158
|
+
corelib/core/time/hour_spec
|
|
159
|
+
corelib/core/time/inspect_spec
|
|
160
|
+
corelib/core/time/local_spec
|
|
161
|
+
corelib/core/time/mday_spec
|
|
162
|
+
corelib/core/time/min_spec
|
|
163
|
+
corelib/core/time/minus_spec
|
|
164
|
+
corelib/core/time/mktime_spec
|
|
165
|
+
corelib/core/time/mon_spec
|
|
166
|
+
corelib/core/time/monday_spec
|
|
167
|
+
corelib/core/time/month_spec
|
|
168
|
+
# corelib/core/time/new_spec - js parse error (xstring in shared/now)
|
|
169
|
+
# corelib/core/time/now_spec - js parse error (xstring in shared/now)
|
|
170
|
+
corelib/core/time/plus_spec
|
|
171
|
+
corelib/core/time/saturday_spec
|
|
172
|
+
corelib/core/time/sec_spec
|
|
173
|
+
corelib/core/time/strftime_spec
|
|
174
|
+
corelib/core/time/sunday_spec
|
|
175
|
+
corelib/core/time/thursday_spec
|
|
176
|
+
corelib/core/time/times_spec
|
|
177
|
+
corelib/core/time/to_i_spec
|
|
178
|
+
corelib/core/time/to_s_spec
|
|
179
|
+
corelib/core/time/tuesday_spec
|
|
180
|
+
corelib/core/time/utc_offset_spec
|
|
181
|
+
corelib/core/time/utc_spec
|
|
182
|
+
corelib/core/time/wday_spec
|
|
183
|
+
corelib/core/time/wednesday_spec
|
|
184
|
+
corelib/core/time/yday_spec
|
|
185
|
+
corelib/core/time/year_spec
|
|
186
|
+
|
|
187
|
+
corelib/core/regexp/escape_spec
|
|
188
|
+
corelib/core/regexp/match_spec
|
|
189
|
+
corelib/core/regexp/quote_spec
|
|
190
|
+
|
|
191
|
+
corelib/language/BEGIN_spec
|
|
192
|
+
corelib/language/alias_spec
|
|
193
|
+
corelib/language/and_spec
|
|
194
|
+
corelib/language/array_spec
|
|
195
|
+
# corelib/language/block_spec - can't parse |(a, (b, c))| args, or |a, b; c, d|
|
|
196
|
+
# corelib/language/break_spec - can't parse break expr with block
|
|
197
|
+
corelib/language/case_spec
|
|
198
|
+
corelib/language/class_spec
|
|
199
|
+
corelib/language/class_variable_spec
|
|
200
|
+
corelib/language/constants_spec
|
|
201
|
+
# corelib/language/def_spec - can't parse f('key'=>'value', *[5, 'string'])
|
|
202
|
+
corelib/language/defined_spec
|
|
203
|
+
# corelib/language/encoding_spec - can't parse encodings
|
|
204
|
+
corelib/language/ensure_spec
|
|
205
|
+
# corelib/language/execution_spec - can't parse x-strings with shell commands
|
|
206
|
+
# corelib/language/file_spec - $LOADED_FEATURES not present
|
|
207
|
+
# corelib/language/for_spec - can't parse for-in expressions
|
|
208
|
+
corelib/language/hash_spec
|
|
209
|
+
# corelib/language/if_spec - Can't parse "if expr: value"
|
|
210
|
+
# corelib/language/line_spec - $LOADED_FEATURES not present
|
|
211
|
+
# corelib/language/lambda_spec - Can't parse literal {} in parenthesized argument list
|
|
212
|
+
corelib/language/loop_spec
|
|
213
|
+
corelib/language/magic_comment_spec
|
|
214
|
+
# corelib/language/match_spec - generates invalid regexp
|
|
215
|
+
corelib/language/metaclass_spec
|
|
216
|
+
corelib/language/module_spec
|
|
217
|
+
# corelib/language/next_spec - can't parse break expr with block
|
|
218
|
+
corelib/language/not_spec
|
|
219
|
+
# corelib/language/numbers_spec - can't parse numbers using control characters
|
|
220
|
+
corelib/language/or_spec
|
|
221
|
+
corelib/language/order_spec
|
|
222
|
+
corelib/language/precedence_spec
|
|
223
|
+
# corelib/language/predefined_spec - ruby_exe() specs all failing
|
|
224
|
+
corelib/language/private_spec
|
|
225
|
+
# corelib/language/proc_spec - javascript Parse error
|
|
226
|
+
corelib/language/redo_spec
|
|
227
|
+
# corelib/language/regexp_spec - invalid javascript Regexp
|
|
228
|
+
corelib/language/rescue_spec
|
|
229
|
+
corelib/language/retry_spec
|
|
230
|
+
# corelib/language/return_spec - can't parse return with expr using block
|
|
231
|
+
# corelib/language/send_spec - can't parse trailing comma in call argument list
|
|
232
|
+
corelib/language/singleton_class_spec
|
|
233
|
+
# corelib/language/splat_spec - can't parse all splats
|
|
234
|
+
# corelib/language/string_spec - can't parse strings using control-characters
|
|
235
|
+
corelib/language/super_spec
|
|
236
|
+
# corelib/language/symbol_spec - lots fail
|
|
237
|
+
# corelib/language/throw_spec - unsupported
|
|
238
|
+
corelib/language/undef_spec
|
|
239
|
+
# corelib/language/unless_spec - cant parse 'unless expr: value'
|
|
240
|
+
corelib/language/until_spec
|
|
241
|
+
# corelib/language/variables_spec - can't parse whole file
|
|
242
|
+
corelib/language/while_spec
|
|
243
|
+
# corelib/language/yield_spec - can't parse destructuring argument list, see block_spec
|
|
244
|
+
|
|
245
|
+
stdlib/rubysl-singleton/spec/
|
|
246
|
+
stdlib/rubysl-observer/spec/
|
|
247
|
+
|
|
248
|
+
stdlib/rubysl-strscan/spec/bol_spec
|
|
249
|
+
stdlib/rubysl-strscan/spec/check_spec
|
|
250
|
+
stdlib/rubysl-strscan/spec/element_reference_spec
|
|
251
|
+
stdlib/rubysl-strscan/spec/get_byte_spec
|
|
252
|
+
stdlib/rubysl-strscan/spec/pos_spec
|
|
253
|
+
stdlib/rubysl-strscan/spec/scan_spec
|
|
254
|
+
stdlib/rubysl-strscan/spec/skip_spec
|
|
255
|
+
stdlib/rubysl-strscan/spec/terminate_spec
|
|
256
|
+
|
|
257
|
+
stdlib/rubysl-delegate/spec/delegator/send_spec
|
|
258
|
+
|
|
259
|
+
stdlib/rubysl-erb/spec/util/html_escape_spec
|
|
260
|
+
|
|
261
|
+
stdlib/rubysl-set/spec/initialize_spec
|
|
262
|
+
stdlib/rubysl-set/spec/add_spec
|
|
263
|
+
stdlib/rubysl-set/spec/append_spec
|
|
264
|
+
stdlib/rubysl-set/spec/clear_spec
|
|
265
|
+
stdlib/rubysl-set/spec/constructor_spec
|
|
266
|
+
stdlib/rubysl-set/spec/each_spec
|
|
267
|
+
stdlib/rubysl-set/spec/empty_spec
|
|
268
|
+
stdlib/rubysl-set/spec/equal_value_spec
|
|
269
|
+
stdlib/rubysl-set/spec/include_spec
|
|
270
|
+
stdlib/rubysl-set/spec/length_spec
|
|
271
|
+
stdlib/rubysl-set/spec/member_spec
|
|
272
|
+
stdlib/rubysl-set/spec/merge_spec
|
|
273
|
+
stdlib/rubysl-set/spec/size_spec
|
|
274
|
+
stdlib/rubysl-set/spec/to_a_spec
|
|
275
|
+
stdlib/rubysl-set/spec/enumerable/to_set_spec
|
|
276
|
+
|
|
277
|
+
stdlib/rubysl-pathname/spec/new_spec
|
|
278
|
+
stdlib/rubysl-pathname/spec/equal_value_spec
|
|
279
|
+
stdlib/rubysl-pathname/spec/absolute_spec
|
|
280
|
+
stdlib/rubysl-pathname/spec/relative_spec
|
|
281
|
+
|
|
282
|
+
stdlib/rubysl-date/spec/date/add_spec
|
|
283
|
+
stdlib/rubysl-date/spec/date/eql_spec
|
|
284
|
+
stdlib/rubysl-date/spec/date/minus_spec
|
|
285
|
+
stdlib/rubysl-date/spec/date/plus_spec
|