opal 0.8.0.beta1 → 0.8.0.rc1

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -24
  3. data/.jshintrc +51 -0
  4. data/.travis.yml +6 -1
  5. data/CHANGELOG.md +2 -0
  6. data/Gemfile +3 -7
  7. data/README.md +2 -3
  8. data/Rakefile +1 -0
  9. data/lib/mspec/opal/rake_task.rb +1 -1
  10. data/lib/opal/builder.rb +21 -3
  11. data/lib/opal/builder_processors.rb +2 -2
  12. data/lib/opal/cli.rb +8 -5
  13. data/lib/opal/erb.rb +1 -1
  14. data/lib/opal/nodes/call.rb +1 -1
  15. data/lib/opal/nodes/call_special.rb +1 -1
  16. data/lib/opal/nodes/helpers.rb +6 -4
  17. data/lib/opal/nodes/iter.rb +2 -2
  18. data/lib/opal/nodes/singleton_class.rb +2 -1
  19. data/lib/opal/parser/lexer.rb +3 -2
  20. data/lib/opal/path_reader.rb +8 -1
  21. data/lib/opal/paths.rb +23 -16
  22. data/lib/opal/regexp_anchors.rb +5 -0
  23. data/lib/opal/sprockets/erb.rb +1 -1
  24. data/lib/opal/sprockets/processor.rb +21 -35
  25. data/lib/opal/sprockets/source_map_server.rb +5 -5
  26. data/lib/opal/version.rb +3 -1
  27. data/lib/tilt/opal.rb +11 -5
  28. data/opal.gemspec +2 -2
  29. data/opal/corelib/array.rb +196 -4
  30. data/opal/corelib/enumerable.rb +1 -1
  31. data/opal/corelib/enumerator.rb +2 -2
  32. data/opal/corelib/hash.rb +6 -6
  33. data/opal/corelib/kernel.rb +5 -3
  34. data/opal/corelib/module.rb +18 -12
  35. data/opal/corelib/regexp.rb +110 -4
  36. data/opal/corelib/runtime.js +12 -4
  37. data/opal/corelib/string.rb +51 -95
  38. data/opal/corelib/string/inheritance.rb +22 -0
  39. data/opal/corelib/variables.rb +1 -1
  40. data/spec/filters/bugs/array.rb +3 -39
  41. data/spec/filters/bugs/basic_object.rb +20 -0
  42. data/spec/filters/bugs/date.rb +5 -0
  43. data/spec/filters/bugs/enumerable.rb +9 -0
  44. data/spec/filters/bugs/enumerator.rb +0 -7
  45. data/spec/filters/bugs/hash.rb +2 -0
  46. data/spec/filters/bugs/kernel.rb +5 -0
  47. data/spec/filters/bugs/language.rb +14 -0
  48. data/spec/filters/bugs/method.rb +5 -0
  49. data/spec/filters/bugs/module.rb +23 -0
  50. data/spec/filters/bugs/regular_expressions.rb +41 -0
  51. data/spec/filters/bugs/singleton.rb +3 -0
  52. data/spec/filters/bugs/string.rb +2 -9
  53. data/spec/filters/bugs/stringscanner.rb +3 -0
  54. data/spec/filters/bugs/time.rb +19 -0
  55. data/spec/filters/unsupported/module.rb +6 -0
  56. data/spec/filters/unsupported/mutable_strings.rb +8 -0
  57. data/spec/filters/unsupported/regular_expressions.rb +90 -0
  58. data/spec/lib/builder_spec.rb +12 -6
  59. data/spec/lib/cli_spec.rb +2 -2
  60. data/spec/lib/path_reader_spec.rb +12 -0
  61. data/spec/lib/sprockets/server_spec.rb +7 -8
  62. data/spec/lib/tilt/opal_spec.rb +18 -0
  63. data/spec/opal/core/language/regexp_spec.rb +1 -1
  64. data/spec/opal/core/runtime/bridged_classes_spec.rb +48 -1
  65. data/spec/rubyspecs +88 -78
  66. data/stdlib/encoding.rb +3 -0
  67. data/stdlib/native.rb +1 -1
  68. data/stdlib/pp.rb +27 -6
  69. data/stdlib/set.rb +10 -0
  70. data/tasks/linting.rake +18 -0
  71. data/tasks/testing.rake +11 -4
  72. data/{stdlib → vendored-minitest}/minitest.rb +0 -0
  73. data/{stdlib → vendored-minitest}/minitest/assertions.rb +0 -0
  74. data/{stdlib → vendored-minitest}/minitest/autorun.rb +0 -0
  75. data/{stdlib → vendored-minitest}/minitest/benchmark.rb +0 -0
  76. data/{stdlib → vendored-minitest}/minitest/expectations.rb +0 -0
  77. data/{stdlib → vendored-minitest}/minitest/hell.rb +0 -0
  78. data/{stdlib → vendored-minitest}/minitest/mock.rb +0 -0
  79. data/{stdlib → vendored-minitest}/minitest/parallel.rb +0 -0
  80. data/{stdlib → vendored-minitest}/minitest/pride.rb +0 -0
  81. data/{stdlib → vendored-minitest}/minitest/pride_plugin.rb +0 -0
  82. data/{stdlib → vendored-minitest}/minitest/spec.rb +0 -0
  83. data/{stdlib → vendored-minitest}/minitest/test.rb +0 -0
  84. data/{stdlib → vendored-minitest}/minitest/unit.rb +0 -0
  85. data/vendored-minitest/test/unit.rb +23 -0
  86. metadata +31 -29
  87. data/stdlib/test/unit.rb +0 -10
  88. data/tasks/documentation.rake +0 -38
@@ -92,4 +92,26 @@ class String::Wrapper
92
92
  }
93
93
  }
94
94
  end
95
+
96
+ def split(pattern = undefined, limit = undefined)
97
+ @literal.split(pattern, limit).map{|str| self.class.allocate(str)}
98
+ end
99
+
100
+ def replace(string)
101
+ @literal = string
102
+ end
103
+
104
+ def each_line(separator = $/)
105
+ return enum_for :each_line, separator unless block_given?
106
+ @literal.each_line(separator){|str| yield self.class.allocate(str)}
107
+ end
108
+
109
+ def lines(separator = $/, &block)
110
+ e = each_line(separator, &block)
111
+ block ? self : e.to_a
112
+ end
113
+
114
+ def %(data)
115
+ @literal % data
116
+ end
95
117
  end
@@ -20,5 +20,5 @@ $SAFE = 0
20
20
  RUBY_PLATFORM = 'opal'
21
21
  RUBY_ENGINE = 'opal'
22
22
  RUBY_VERSION = '2.1.1'
23
- RUBY_ENGINE_VERSION = '0.8.0.dev'
23
+ RUBY_ENGINE_VERSION = '0.8.0.rc1'
24
24
  RUBY_RELEASE_DATE = '2015-02-14'
@@ -1,16 +1,6 @@
1
1
  opal_filter "Array" do
2
2
  fails "Array#clone copies singleton methods"
3
3
 
4
- fails "Array#combination generates from a defensive copy, ignoring mutations"
5
- fails "Array#combination yields a partition consisting of only singletons"
6
- fails "Array#combination yields [] when length is 0"
7
- fails "Array#combination yields a copy of self if the argument is the size of the receiver"
8
- fails "Array#combination yields nothing if the argument is out of bounds"
9
- fails "Array#combination yields the expected combinations"
10
- fails "Array#combination yields nothing for out of bounds length and return self"
11
- fails "Array#combination returns self when a block is given"
12
- fails "Array#combination returns an enumerator when no block is provided"
13
-
14
4
  fails "Array#<=> calls <=> left to right and return first non-0 result"
15
5
  fails "Array#<=> returns -1 if the arrays have same length and a pair of corresponding elements returns -1 for <=>"
16
6
  fails "Array#<=> returns +1 if the arrays have same length and a pair of corresponding elements returns +1 for <=>"
@@ -91,21 +81,6 @@ opal_filter "Array" do
91
81
 
92
82
  fails "Array#rindex rechecks the array size during iteration"
93
83
 
94
- fails "Array#rotate! with an argument n raises a TypeError if not passed an integer-like argument"
95
- fails "Array#rotate! with an argument n coerces the argument using to_int"
96
- fails "Array#rotate! with an argument n moves the first (n % size) elements at the end and returns self"
97
- fails "Array#rotate! when passed no argument moves the first element to the end and returns self"
98
- fails "Array#rotate! raises a RuntimeError on a frozen array"
99
- fails "Array#rotate! does nothing and returns self when the length is zero or one"
100
- fails "Array#rotate with an argument n raises a TypeError if not passed an integer-like argument"
101
- fails "Array#rotate with an argument n coerces the argument using to_int"
102
- fails "Array#rotate with an argument n returns a copy of the array with the first (n % size) elements moved at the end"
103
- fails "Array#rotate when passed no argument returns a copy of the array with the first element moved at the end"
104
- fails "Array#rotate does not return subclass instance for Array subclasses"
105
- fails "Array#rotate does not return self"
106
- fails "Array#rotate does not mutate the receiver"
107
- fails "Array#rotate returns a copy of the array when its length is one or zero"
108
-
109
84
  fails "Array#sample calls #rand on the Object passed by the :random key in the arguments Hash"
110
85
  fails "Array#sample calls #to_hash to convert the passed Object"
111
86
  fails "Array#sample calls #to_int on the Object returned by #rand"
@@ -165,20 +140,6 @@ opal_filter "Array" do
165
140
 
166
141
  fails "Array#uniq! compares elements based on the value returned from the block"
167
142
 
168
- fails "Array#values_at returns an array of elements at the indexes when passed indexes"
169
- fails "Array#values_at calls to_int on its indices"
170
- fails "Array#values_at returns an array of elements in the ranges when passes ranges"
171
- fails "Array#values_at calls to_int on arguments of ranges when passes ranges"
172
- fails "Array#values_at does not return subclass instance on Array subclasses"
173
- fails "Array#values_at when passed ranges returns an array of elements in the ranges"
174
- fails "Array#values_at when passed ranges calls to_int on arguments of ranges"
175
- fails "Array#values_at when passed a range fills with nil if the index is out of the range"
176
- fails "Array#values_at when passed a range on an empty array fills with nils if the index is out of the range"
177
-
178
-
179
- fails "Array#zip calls #to_ary to convert the argument to an Array"
180
- fails "Array#zip uses #each to extract arguments' elements when #to_ary fails"
181
-
182
143
  fails "Array#hash returns the same fixnum for arrays with the same content"
183
144
 
184
145
  fails "Array#partition returns in the left array values for which the block evaluates to true"
@@ -190,4 +151,7 @@ opal_filter "Array" do
190
151
  fails "Array#<=> properly handles recursive arrays"
191
152
  fails "Array#values_at properly handles recursive arrays"
192
153
  fails "Array#hash returns the same hash for equal recursive arrays through hashes"
154
+
155
+ fails "Array#first raises a RangeError when count is a Bignum"
156
+ fails "Array#hash calls to_int on result of calling hash on each element"
193
157
  end
@@ -11,4 +11,24 @@ opal_filter "BasicObject" do
11
11
  fails "BasicObject does not define built-in constants (according to const_defined?)"
12
12
  fails "BasicObject raises NameError when referencing built-in constants"
13
13
  fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed"
14
+
15
+ fails "BasicObject#__id__ returns a different value for two Bignum literals"
16
+ fails "BasicObject#__id__ returns a different value for two Float literals"
17
+ fails "BasicObject#__id__ returns a different value for two String literals"
18
+ fails "BasicObject#initialize does not accept arguments"
19
+ fails "BasicObject#instance_eval binds self to the receiver"
20
+ fails "BasicObject#instance_eval executes in the context of the receiver"
21
+ fails "BasicObject#instance_eval has access to receiver's instance variables"
22
+ fails "BasicObject#instance_eval treats block-local variables as local to the block"
23
+ fails "BasicObject#instance_eval sets class variables in the receiver"
24
+ fails "BasicObject#instance_eval makes the receiver metaclass the scoped class when used with a string"
25
+ fails "BasicObject#instance_eval gets constants in the receiver if a string given"
26
+ fails "BasicObject#instance_eval raises a TypeError when defining methods on an immediate"
27
+ fails "BasicObject#instance_eval raises a TypeError when defining methods on numerics"
28
+ fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
29
+ fails "BasicObject#instance_exec has an arity of -1"
30
+ fails "BasicObject#instance_exec binds the block's binding self to the receiver"
31
+ fails "BasicObject#instance_exec sets class variables in the receiver"
32
+ fails "BasicObject#instance_exec raises a TypeError when defining methods on an immediate"
33
+ fails "BasicObject#instance_exec raises a TypeError when defining methods on numerics"
14
34
  end
@@ -12,4 +12,9 @@ opal_filter "Date" do
12
12
  fails "Date#strftime should be able to show the commercial week day"
13
13
  fails "Date#strftime should be able to show the week number with the week starting on sunday and monday"
14
14
  fails "Date#strftime should be able to show the number of seconds since the unix epoch"
15
+
16
+ fails "Date#strftime should be able to print the julian day with leading zeroes"
17
+ fails "Date#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)"
18
+ fails "Date#strftime should be able to show the timezone with a : separator"
19
+ fails "Date#strftime shows the number of milliseconds since epoch"
15
20
  end
@@ -66,4 +66,13 @@ opal_filter "Enumerable" do
66
66
  fails "Enumerable#zip converts arguments to arrays using #to_ary"
67
67
  fails "Enumerable#zip converts arguments to enums using #to_enum"
68
68
  fails "Enumerable#zip gathers whole arrays as elements when each yields multiple"
69
+
70
+ fails "Enumerable#first raises a RangeError when passed a Bignum"
71
+ fails "Enumerable#to_h converts empty enumerable to empty hash"
72
+ fails "Enumerable#to_h converts yielded [key, value] pairs to a hash"
73
+ fails "Enumerable#to_h uses the last value of a duplicated key"
74
+ fails "Enumerable#to_h calls #to_ary on contents"
75
+ fails "Enumerable#to_h forwards arguments to #each"
76
+ fails "Enumerable#to_h raises TypeError if an element is not an array"
77
+ fails "Enumerable#to_h raises ArgumentError if an element is not a [key, value] pair"
69
78
  end
@@ -1,10 +1,3 @@
1
1
  opal_filter "Enumerator" do
2
2
  fails "Enumerator#each requires multiple arguments" # arity issue
3
-
4
- fails "Enumerator#with_index returns the object being enumerated when given a block"
5
- fails "Enumerator#with_index numbers indices from the given index when given an offset but no block"
6
- fails "Enumerator#with_index numbers indices from the given index when given an offset and block"
7
- fails "Enumerator#with_index converts non-numeric arguments to Integer via #to_int"
8
- fails "Enumerator#with_index coerces the given numeric argument to an Integer"
9
- fails "Enumerator#with_index accepts negative argument"
10
3
  end
@@ -107,4 +107,6 @@ opal_filter "Hash" do
107
107
  fails "Hash.try_convert returns nil when the argument does not respond to #to_hash"
108
108
  fails "Hash.try_convert returns the argument if it's a kind of Hash"
109
109
  fails "Hash.try_convert returns the argument if it's a Hash"
110
+
111
+ fails "Hash#compare_by_identity does not copy string keys"
110
112
  end
@@ -10,4 +10,9 @@ opal_filter "Kernel" do
10
10
  fails "Kernel#String raises a TypeError if respond_to? returns false for #to_s"
11
11
  fails "Kernel#String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true"
12
12
  fails "Kernel#String calls #to_s if #respond_to?(:to_s) returns true"
13
+
14
+ fails "Kernel.Float returns a Float for Complex with only a real part"
15
+ fails "Kernel.Float raises a RangeError when passed a Complex argument"
16
+ fails "Kernel#Float returns a Float for Complex with only a real part"
17
+ fails "Kernel#Float raises a RangeError when passed a Complex argument"
13
18
  end
@@ -413,4 +413,18 @@ opal_filter "language" do
413
413
 
414
414
  fails "The __FILE__ pseudo-variable equals the absolute path of a file loaded by an absolute path" # we can't clear $LOADED_FEATURES, should be treated as readonly
415
415
  fails "The __FILE__ pseudo-variable equals the absolute path of a file loaded by a relative path" # we can't clear $LOADED_FEATURES, should be treated as readonly
416
+
417
+ fails "Assigning an anonymous module to a constant does not set the name of a module scoped by an anonymous module"
418
+ fails "A number literal can be an integer literal with trailing 'r' to represent a Rational"
419
+ fails "A number literal can be a decimal literal with trailing 'r' to represent a Rational"
420
+ fails "A number literal can be a hexadecimal literal with trailing 'r' to represent a Rational"
421
+ fails "A number literal can be an octal literal with trailing 'r' to represent a Rational"
422
+ fails "A number literal can be a binary literal with trailing 'r' to represent a Rational"
423
+ fails "A number literal can be an integer literal with trailing 'i' to represent a Complex"
424
+ fails "A number literal can be a decimal literal with trailing 'i' to represent a Complex"
425
+ fails "A number literal can be a hexadecimal literal with trailing 'i' to represent a Complex"
426
+ fails "A number literal can be a octal literal with trailing 'i' to represent a Complex"
427
+ fails "A number literal can be a binary literal with trailing 'i' to represent a Complex"
428
+ fails "The while expression stops running body if interrupted by break in a parenthesized element op-assign value"
429
+ fails "The while expression stops running body if interrupted by break in a begin ... end element op-assign value"
416
430
  end
@@ -0,0 +1,5 @@
1
+ opal_filter "Method" do
2
+ fails "Method#define_method when passed a Method object defines a method with the same #parameters as the original"
3
+ fails "Method#define_method when passed an UnboundMethod object defines a method with the same #arity as the original"
4
+ fails "Method#define_method when passed an UnboundMethod object defines a method with the same #parameters as the original"
5
+ end
@@ -1,4 +1,23 @@
1
1
  opal_filter "Module" do
2
+ fails "passed { |a, b = 1| } creates a method that raises an ArgumentError when passed zero arguments"
3
+ fails "passed { |a, b = 1| } creates a method that raises an ArgumentError when passed three arguments"
4
+ fails "Module#define_method passed { } creates a method that raises an ArgumentError when passed one argument"
5
+ fails "Module#define_method calls #method_added after the method is added to the Module"
6
+ fails "Module#define_method passed { } creates a method that raises an ArgumentError when passed two arguments"
7
+ fails "Module#define_method passed { || } creates a method that raises an ArgumentError when passed one argument"
8
+ fails "Module#define_method passed { || } creates a method that raises an ArgumentError when passed two arguments"
9
+ fails "Module#define_method passed { |a| } creates a method that raises an ArgumentError when passed zero arguments"
10
+ fails "Module#define_method passed { |a| } creates a method that raises an ArgumentError when passed zero arguments and a block"
11
+ fails "Module#define_method passed { |a| } creates a method that raises an ArgumentError when passed two arguments"
12
+ fails "Module#define_method passed { |a, *b| } creates a method that raises an ArgumentError when passed zero arguments"
13
+ fails "Module#define_method passed { |a, b| } creates a method that raises an ArgumentError when passed zero arguments"
14
+ fails "Module#define_method passed { |a, b| } creates a method that raises an ArgumentError when passed one argument"
15
+ fails "Module#define_method passed { |a, b| } creates a method that raises an ArgumentError when passed one argument and a block"
16
+ fails "Module#define_method passed { |a, b| } creates a method that raises an ArgumentError when passed three arguments"
17
+ fails "Module#define_method passed { |a, b, *c| } creates a method that raises an ArgumentError when passed zero arguments"
18
+ fails "Module#define_method passed { |a, b, *c| } creates a method that raises an ArgumentError when passed one argument"
19
+ fails "Module#define_method passed { |a, b, *c| } creates a method that raises an ArgumentError when passed one argument and a block"
20
+ fails "Module#define_method does not change the arity check style of the original proc"
2
21
  fails "A class definition has no class variables"
3
22
  fails "A class definition allows the declaration of class variables in the body"
4
23
  fails "A class definition allows the declaration of class variables in a class method"
@@ -49,4 +68,8 @@ opal_filter "Module" do
49
68
  fails "Module#include ignores modules it has already included via module mutual inclusion"
50
69
  fails "Module#include? returns true if the given module is included by self or one of it's ancestors"
51
70
  fails "Module#include? raises a TypeError when no module was given"
71
+
72
+ fails "Module#module_function as a toggle (no arguments) in a Module body doesn't affect definitions when inside an eval even if the definitions are outside of it"
73
+ fails "Module#define_method raises a TypeError when an UnboundMethod from a child class is defined on a parent class"
74
+ fails "Module#define_method raises a TypeError when an UnboundMethod from one class is defined on an unrelated class"
52
75
  end
@@ -0,0 +1,41 @@
1
+ opal_filter "regular_expressions" do
2
+ fails "Regexp.new works by default for subclasses with overridden #initialize"
3
+ fails "Regexp.new given a String raises a RegexpError when passed an incorrect regexp"
4
+ fails "Regexp.new given a String with escaped characters raises a RegexpError if \\x is not followed by any hexadecimal digits"
5
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\n'"
6
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\t'"
7
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\r'"
8
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\f'"
9
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\v'"
10
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\a'"
11
+ fails "Regexp.new given a String with escaped characters accepts '\\C-\\e'"
12
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\n'"
13
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\t'"
14
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\r'"
15
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\f'"
16
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\v'"
17
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\a'"
18
+ fails "Regexp.new given a String with escaped characters accepts '\\c\\e'"
19
+ fails "Regexp.new given a String with escaped characters raises a RegexpError if more than six hexadecimal digits are given"
20
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\n'"
21
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\t'"
22
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\r'"
23
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\f'"
24
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\v'"
25
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\a'"
26
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\e'"
27
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\n'"
28
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\t'"
29
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\r'"
30
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\f'"
31
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\v'"
32
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\a'"
33
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\C-\\e'"
34
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\n'"
35
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\t'"
36
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\r'"
37
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\f'"
38
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\v'"
39
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\a'"
40
+ fails "Regexp.new given a String with escaped characters accepts '\\M-\\c\\e'"
41
+ end
@@ -1,4 +1,7 @@
1
1
  opal_filter "Singleton" do
2
2
  fails "Singleton.instance returns an instance of the singleton's clone"
3
3
  fails "Singleton.instance returns the same instance for multiple class to instance on clones"
4
+
5
+ fails "Singleton._load returns the singleton instance for anything passed in"
6
+ fails "Singleton._load returns the singleton instance for anything passed in to subclass"
4
7
  end
@@ -9,16 +9,9 @@ opal_filter "String" do
9
9
 
10
10
  fails "String#dup does not copy constants defined in the singleton class"
11
11
 
12
- fails "String#each_line yields subclass instances for subclasses"
13
-
14
- fails "String#lines yields subclass instances for subclasses"
15
-
16
- fails "String#split with String returns subclass instances based on self"
12
+ #The following failing only on phantomjs v1.9.8
13
+ #OK to remove after we upgrade to phantomjs 2.0
17
14
  fails "String#split with Regexp includes all captures in the result array"
18
- fails "String#split with Regexp does not include non-matching captures in the result array"
19
- fails "String#split with Regexp returns subclass instances based on self"
20
- fails "String#split with Regexp does not call constructor on created subclass instances"
21
- fails "String#split with String does not call constructor on created subclass instances"
22
15
 
23
16
  fails "String#byteslice returns the character code of the character at the given index"
24
17
  fails "String#byteslice returns nil if index is outside of self"
@@ -27,4 +27,7 @@ opal_filter "StringScanner" do
27
27
 
28
28
  fails "StringScanner#rest taints the returned String if the input was tainted"
29
29
  fails "StringScanner#rest returns an instance of String when passed a String subclass"
30
+
31
+ fails "StringScanner#[] raises a IndexError when there's no named capture"
32
+ fails "StringScanner#[] returns named capture"
30
33
  end
@@ -174,4 +174,23 @@ opal_filter "Time" do
174
174
  fails "Time.utc accepts various year ranges"
175
175
  fails "Time.gm accepts various year ranges"
176
176
  fails "Time#yday returns an integer representing the day of the year, 1..366"
177
+
178
+ fails "Time#- returns a time with nanoseconds precision between two time objects"
179
+ fails "Time#strftime with %L formats the milliseconds of a second"
180
+
181
+ fails "Time#strftime should be able to print the commercial year with leading zeroes"
182
+ fails "Time#strftime should be able to print the commercial year with only two digits"
183
+ fails "Time#strftime should be able to print the julian day with leading zeroes"
184
+ fails "Time#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)"
185
+ fails "Time#strftime should be able to show the commercial week day"
186
+ fails "Time#strftime should be able to show the timezone of the date with a : separator"
187
+ fails "Time#strftime should be able to show the number of seconds since the unix epoch"
188
+ fails "Time#strftime should be able to show the timezone if available"
189
+ fails "Time#strftime rounds an offset to the nearest second when formatting with %z"
190
+ fails "Time#strftime with %N formats the nanoseconds of the second with %N"
191
+ fails "Time#strftime with %N formats the milliseconds of the second with %3N"
192
+ fails "Time#strftime with %N formats the microseconds of the second with %6N"
193
+ fails "Time#strftime with %N formats the nanoseconds of the second with %9N"
194
+ fails "Time#strftime with %N formats the picoseconds of the second with %12N"
195
+ fails "Time#strftime should be able to show the commercial week"
177
196
  end
@@ -0,0 +1,6 @@
1
+ opal_filter "Module" do
2
+ fails "Module#define_method raises a RuntimeError if frozen"
3
+ fails "Module#define_method is private"
4
+ fails "Module#define_method when name is :initialize passed a block sets visibility to private when method name is :initialize"
5
+ fails "Module#define_method when name is :initialize given an UnboundMethod sets the visibility to private when method is named :initialize"
6
+ end
@@ -99,6 +99,8 @@ opal_filter "Mutable strings are not supported in Opal" do
99
99
  fails "String#<< when self and the argument are in different ASCII-compatible encodings uses the argument's encoding if self is ASCII-only"
100
100
  fails "String#<< when self and the argument are in different ASCII-compatible encodings raises Encoding::CompatibilityError if neither are ASCII-only"
101
101
  fails "String#<< when self is ASCII-8BIT and argument is US-ASCII uses ASCII-8BIT encoding"
102
+ fails "String#<< returns a String when given a subclass instance"
103
+ fails "String#<< returns an instance of same class when called on a subclass"
102
104
 
103
105
  fails "String#chomp when passed no argument returns a copy of the String when it is not modified"
104
106
 
@@ -203,6 +205,8 @@ opal_filter "Mutable strings are not supported in Opal" do
203
205
  fails "String#slice! with String doesn't call to_str on its argument"
204
206
  fails "String#slice! with String returns a subclass instance when given a subclass instance"
205
207
  fails "String#slice! with String raises a RuntimeError if self is frozen"
208
+ fails "String#slice! with Regexp, index accepts a Float for capture index"
209
+ fails "String#slice! with Regexp, index calls #to_int to convert an Object to capture index"
206
210
 
207
211
  fails "String#[]= with Fixnum index replaces the char at idx with other_str"
208
212
  fails "String#[]= with Fixnum index taints self if other_str is tainted"
@@ -317,6 +321,8 @@ opal_filter "Mutable strings are not supported in Opal" do
317
321
  fails "String#setbyte changes the byte at the given index to the new byte"
318
322
  fails "String#setbyte modifies the receiver"
319
323
  fails "String#setbyte returns an Integer"
324
+ fails "String#setbyte calls #to_int to convert the index"
325
+ fails "String#setbyte calls to_int to convert the value"
320
326
 
321
327
  fails "String#prepend taints self if other is tainted"
322
328
  fails "String#prepend works when given a subclass instance"
@@ -378,6 +384,8 @@ opal_filter "Mutable strings are not supported in Opal" do
378
384
  fails "String#concat when self and the argument are in different ASCII-compatible encodings uses the argument's encoding if self is ASCII-only"
379
385
  fails "String#concat when self and the argument are in different ASCII-compatible encodings raises Encoding::CompatibilityError if neither are ASCII-only"
380
386
  fails "String#concat when self is ASCII-8BIT and argument is US-ASCII uses ASCII-8BIT encoding"
387
+ fails "String#concat returns a String when given a subclass instance"
388
+ fails "String#concat returns an instance of same class when called on a subclass"
381
389
 
382
390
  fails "String#dup does not modify the original string when changing dupped string"
383
391
 
@@ -44,4 +44,94 @@ opal_filter "regular_expressions" do
44
44
  fails "String#scan supports \\G which matches the end of the previous match / string start for first match"
45
45
 
46
46
  fails "String#sub with pattern, replacement supports \\G which matches at the beginning of the string"
47
+
48
+ fails "Regexp#options includes Regexp::FIXEDENCODING for a Regexp literal with the 'u' option"
49
+ fails "Regexp#options includes Regexp::FIXEDENCODING for a Regexp literal with the 'e' option"
50
+ fails "Regexp#options includes Regexp::FIXEDENCODING for a Regexp literal with the 's' option"
51
+ fails "Regexp#options does not include Regexp::FIXEDENCODING for a Regexp literal with the 'n' option"
52
+ fails "Regexp#options includes Regexp::NOENCODING for a Regexp literal with the 'n' option"
53
+
54
+ fails "Regexp.union returns a Regexp with the encoding of an ASCII-incompatible String argument"
55
+ fails "Regexp.union returns a Regexp with the encoding of a String containing non-ASCII-compatible characters"
56
+ fails "Regexp.union returns a Regexp with US-ASCII encoding if all arguments are ASCII-only"
57
+ fails "Regexp.union returns a Regexp with the encoding of multiple non-conflicting ASCII-incompatible String arguments"
58
+ fails "Regexp.union returns a Regexp with the encoding of multiple non-conflicting Strings containing non-ASCII-compatible characters"
59
+ fails "Regexp.union returns a Regexp with the encoding of a String containing non-ASCII-compatible characters and another ASCII-only String"
60
+ fails "Regexp.union returns a Regexp with UTF-8 if one part is UTF-8"
61
+ fails "Regexp.union raises ArgumentError if the arguments include conflicting ASCII-incompatible Regexps"
62
+ fails "Regexp.union raises ArgumentError if the arguments include conflicting fixed encoding Regexps"
63
+ fails "Regexp.union raises ArgumentError if the arguments include a fixed encoding Regexp and a String containing non-ASCII-compatible characters in a different encoding"
64
+ fails "Regexp.union raises ArgumentError if the arguments include a String containing non-ASCII-compatible characters and a fixed encoding Regexp in a different encoding"
65
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only String"
66
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only String"
67
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible String and an ASCII-only Regexp"
68
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible Regexp and an ASCII-only Regexp"
69
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible String and a String containing non-ASCII-compatible characters in a different encoding"
70
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a String containing non-ASCII-compatible characters in a different encoding"
71
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible String and a Regexp containing non-ASCII-compatible characters in a different encoding"
72
+ fails "Regexp.union raises ArgumentError if the arguments include an ASCII-incompatible Regexp and a Regexp containing non-ASCII-compatible characters in a different encoding"
73
+
74
+ fails "Regexp.new given a Regexp uses US_ASCII encoding if third argument is 'n' or 'none' (case insensitive) and only ascii characters"
75
+ fails "Regexp.new given a Regexp uses ASCII_8BIT encoding if third argument is 'n' or 'none' (case insensitive) and non-ascii characters"
76
+ fails "Regexp.new given a Regexp returns a Regexp with US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
77
+ fails "Regexp.new given a Regexp returns a Regexp with source String having US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
78
+ fails "Regexp.new given a Regexp returns a Regexp with US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
79
+ fails "Regexp.new given a Regexp returns a Regexp with source String having US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
80
+ fails "Regexp.new given a Regexp returns a Regexp with UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
81
+ fails "Regexp.new given a Regexp returns a Regexp with source String having UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
82
+ fails "Regexp.new given a Regexp returns a Regexp with the input String's encoding"
83
+ fails "Regexp.new given a Regexp returns a Regexp with source String having the input String's encoding"
84
+ fails "Regexp.new given a Regexp sets the encoding to UTF-8 if the Regexp literal has the 'u' option"
85
+ fails "Regexp.new given a Regexp sets the encoding to EUC-JP if the Regexp literal has the 'e' option"
86
+ fails "Regexp.new given a Regexp sets the encoding to Windows-31J if the Regexp literal has the 's' option"
87
+ fails "Regexp.new given a Regexp sets the encoding to US-ASCII if the Regexp literal has the 'n' option and the source String is ASCII only"
88
+ fails "Regexp.new given a Regexp sets the encoding to source String's encoding if the Regexp literal has the 'n' option and the source String is not ASCII only"
89
+ fails "Regexp.new given a String uses US_ASCII encoding if third argument is 'n' or 'none' (case insensitive) and only ascii characters"
90
+ fails "Regexp.new given a String uses ASCII_8BIT encoding if third argument is 'n' or 'none' (case insensitive) and non-ascii characters"
91
+ fails "Regexp.new given a String returns a Regexp with US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
92
+ fails "Regexp.new given a String returns a Regexp with source String having US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
93
+ fails "Regexp.new given a String returns a Regexp with US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
94
+ fails "Regexp.new given a String returns a Regexp with source String having US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
95
+ fails "Regexp.new given a String returns a Regexp with UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
96
+ fails "Regexp.new given a String returns a Regexp with source String having UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
97
+ fails "Regexp.new given a String returns a Regexp with the input String's encoding"
98
+ fails "Regexp.new given a String returns a Regexp with source String having the input String's encoding"
99
+ fails "Regexp.new given a String sets the encoding to UTF-8 if the Regexp literal has the 'u' option"
100
+ fails "Regexp.new given a String sets the encoding to EUC-JP if the Regexp literal has the 'e' option"
101
+ fails "Regexp.new given a String sets the encoding to Windows-31J if the Regexp literal has the 's' option"
102
+ fails "Regexp.new given a String sets the encoding to US-ASCII if the Regexp literal has the 'n' option and the source String is ASCII only"
103
+ fails "Regexp.new given a String sets the encoding to source String's encoding if the Regexp literal has the 'n' option and the source String is not ASCII only"
104
+ fails "Regexp.new given a String with escaped characters uses US_ASCII encoding if third argument is 'n' or 'none' (case insensitive) and only ascii characters"
105
+ fails "Regexp.new given a String with escaped characters uses ASCII_8BIT encoding if third argument is 'n' or 'none' (case insensitive) and non-ascii characters"
106
+ fails "Regexp.new given a String with escaped characters returns a Regexp with US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
107
+ fails "Regexp.new given a String with escaped characters returns a Regexp with source String having US-ASCII encoding if only 7-bit ASCII characters are present regardless of the input String's encoding"
108
+ fails "Regexp.new given a String with escaped characters returns a Regexp with US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
109
+ fails "Regexp.new given a String with escaped characters returns a Regexp with source String having US-ASCII encoding if UTF-8 escape sequences using only 7-bit ASCII are present"
110
+ fails "Regexp.new given a String with escaped characters returns a Regexp with UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
111
+ fails "Regexp.new given a String with escaped characters returns a Regexp with source String having UTF-8 encoding if any UTF-8 escape sequences outside 7-bit ASCII are present"
112
+ fails "Regexp.new given a String with escaped characters returns a Regexp with the input String's encoding"
113
+ fails "Regexp.new given a String with escaped characters returns a Regexp with source String having the input String's encoding"
114
+ fails "Regexp.new given a String with escaped characters sets the encoding to UTF-8 if the Regexp literal has the 'u' option"
115
+ fails "Regexp.new given a String with escaped characters sets the encoding to EUC-JP if the Regexp literal has the 'e' option"
116
+ fails "Regexp.new given a String with escaped characters sets the encoding to Windows-31J if the Regexp literal has the 's' option"
117
+ fails "Regexp.new given a String with escaped characters sets the encoding to US-ASCII if the Regexp literal has the 'n' option and the source String is ASCII only"
118
+ fails "Regexp.new given a String with escaped characters sets the encoding to source String's encoding if the Regexp literal has the 'n' option and the source String is not ASCII only"
119
+ fails "Regexp.new given a String ignores the third argument if it is 'e' or 'euc' (case-insensitive)"
120
+ fails "Regexp.new given a String ignores the third argument if it is 's' or 'sjis' (case-insensitive)"
121
+ fails "Regexp.new given a String ignores the third argument if it is 'u' or 'utf8' (case-insensitive)"
122
+ fails "Regexp.new given a String with escaped characters accepts \\u{H} for a single Unicode codepoint"
123
+ fails "Regexp.new given a String with escaped characters accepts \\u{HH} for a single Unicode codepoint"
124
+ fails "Regexp.new given a String with escaped characters accepts \\u{HHH} for a single Unicode codepoint"
125
+ fails "Regexp.new given a String with escaped characters accepts \\u{HHHH} for a single Unicode codepoint"
126
+ fails "Regexp.new given a String with escaped characters accepts \\u{HHHHH} for a single Unicode codepoint"
127
+ fails "Regexp.new given a String with escaped characters accepts \\u{HHHHHH} for a single Unicode codepoint"
128
+ fails "Regexp.new given a String with escaped characters accepts characters followed by \\u{HHHH}"
129
+ fails "Regexp.new given a String with escaped characters accepts \\u{HHHH} followed by characters"
130
+ fails "Regexp.new given a String with escaped characters accepts escaped hexadecimal digits followed by \\u{HHHH}"
131
+ fails "Regexp.new given a String with escaped characters accepts escaped octal digits followed by \\u{HHHH}"
132
+ fails "Regexp.new given a String with escaped characters accepts a combination of escaped octal and hexadecimal digits and \\u{HHHH}"
133
+ fails "Regexp.new given a String with escaped characters raises a RegexpError if less than four digits are given for \\uHHHH"
134
+ fails "Regexp.new given a String with escaped characters raises a RegexpError if the \\u{} escape is empty"
135
+ # regexp extended related
136
+ fails "Regexp.new given a String accepts a Fixnum of two or more options ORed together as the second argument"
47
137
  end