opal 0.9.0.beta2 → 0.9.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.jshintrc +2 -1
  3. data/.travis.yml +8 -4
  4. data/CHANGELOG.md +270 -251
  5. data/CONTRIBUTING.md +41 -0
  6. data/README.md +8 -8
  7. data/Rakefile +1 -1
  8. data/lib/opal/cli.rb +1 -0
  9. data/lib/opal/cli_options.rb +2 -2
  10. data/lib/opal/cli_runners.rb +1 -0
  11. data/lib/opal/cli_runners/nashorn.rb +58 -0
  12. data/lib/opal/cli_runners/phantom.js +11 -9
  13. data/lib/opal/compiler.rb +2 -0
  14. data/lib/opal/erb.rb +2 -1
  15. data/lib/opal/nodes/def.rb +15 -6
  16. data/lib/opal/nodes/helpers.rb +1 -1
  17. data/lib/opal/nodes/literal.rb +1 -1
  18. data/lib/opal/nodes/masgn.rb +79 -29
  19. data/lib/opal/nodes/module.rb +1 -1
  20. data/lib/opal/nodes/top.rb +6 -2
  21. data/lib/opal/parser.rb +1 -0
  22. data/lib/opal/parser/grammar.rb +3160 -3083
  23. data/lib/opal/parser/grammar.y +39 -11
  24. data/lib/opal/parser/lexer.rb +15 -13
  25. data/lib/opal/parser/sexp.rb +5 -0
  26. data/lib/opal/version.rb +1 -1
  27. data/opal/corelib/array.rb +21 -6
  28. data/opal/corelib/basic_object.rb +17 -4
  29. data/opal/corelib/class.rb +1 -1
  30. data/opal/corelib/constants.rb +2 -2
  31. data/opal/corelib/enumerator.rb +2 -0
  32. data/opal/corelib/hash.rb +50 -50
  33. data/opal/corelib/helpers.rb +1 -1
  34. data/opal/corelib/io.rb +9 -6
  35. data/opal/corelib/kernel.rb +37 -9
  36. data/opal/corelib/module.rb +6 -17
  37. data/opal/corelib/nil.rb +4 -0
  38. data/opal/corelib/number.rb +0 -4
  39. data/opal/corelib/runtime.js +637 -662
  40. data/opal/corelib/struct.rb +7 -3
  41. data/spec/filters/bugs/array.rb +4 -9
  42. data/spec/filters/bugs/basicobject.rb +1 -15
  43. data/spec/filters/bugs/date.rb +4 -26
  44. data/spec/filters/bugs/enumerable.rb +26 -1
  45. data/spec/filters/bugs/enumerator.rb +4 -4
  46. data/spec/filters/bugs/exception.rb +1 -7
  47. data/spec/filters/bugs/float.rb +14 -0
  48. data/spec/filters/bugs/hash.rb +0 -2
  49. data/spec/filters/bugs/integer.rb +1 -1
  50. data/spec/filters/bugs/kernel.rb +47 -66
  51. data/spec/filters/bugs/language.rb +1 -2
  52. data/spec/filters/bugs/module.rb +11 -14
  53. data/spec/filters/bugs/numeric.rb +3 -3
  54. data/spec/filters/bugs/proc.rb +0 -1
  55. data/spec/filters/bugs/range.rb +2 -3
  56. data/spec/filters/bugs/regexp.rb +15 -17
  57. data/spec/filters/bugs/set.rb +2 -2
  58. data/spec/filters/bugs/string.rb +29 -5
  59. data/spec/filters/bugs/{strscan.rb → stringscanner.rb} +9 -10
  60. data/spec/filters/bugs/struct.rb +0 -4
  61. data/spec/filters/bugs/time.rb +2 -3
  62. data/spec/filters/bugs/unboundmethod.rb +3 -0
  63. data/spec/filters/unsupported/freeze.rb +2 -1
  64. data/spec/filters/unsupported/taint.rb +2 -0
  65. data/spec/lib/parser/aref_spec.rb +10 -0
  66. data/spec/lib/parser/lambda_spec.rb +14 -0
  67. data/spec/lib/parser/op_asgn_spec.rb +17 -0
  68. data/spec/lib/parser/return_spec.rb +5 -0
  69. data/spec/lib/parser/unary_spec.rb +4 -0
  70. data/spec/lib/sprockets/erb_spec.rb +1 -1
  71. data/spec/mspec/opal/formatters.rb +159 -0
  72. data/{lib → spec}/mspec/opal/runner.rb +0 -160
  73. data/spec/opal/core/hash/internals_spec.rb +162 -162
  74. data/spec/opal/core/kernel/at_exit_spec.rb +70 -0
  75. data/spec/opal/core/kernel/extend_spec.rb +1 -1
  76. data/spec/opal/core/kernel/instance_variables_spec.rb +56 -0
  77. data/spec/opal/core/language/equal_spec.rb +8 -0
  78. data/spec/opal/core/language/predefined_spec.rb +1 -1
  79. data/spec/opal/core/language/ternary_operator_spec.rb +14 -0
  80. data/spec/opal/core/language/versions/{hash_1.9.rb → hash_1_9_spec.rb} +5 -0
  81. data/spec/opal/core/module/fixtures/classes.rb +11 -1
  82. data/spec/opal/core/module/method_lookup_spec.rb +13 -0
  83. data/spec/opal/core/runtime/super_spec.rb +10 -0
  84. data/spec/opal/stdlib/native/new_spec.rb +84 -0
  85. data/spec/opal/stdlib/strscan/scan_spec.rb +11 -0
  86. data/spec/rubyspecs +6 -9
  87. data/spec/spec_helper.rb +9 -21
  88. data/stdlib/date.rb +121 -1
  89. data/stdlib/js.rb +13 -5
  90. data/stdlib/json.rb +3 -3
  91. data/stdlib/nashorn.rb +5 -0
  92. data/stdlib/nashorn/file.rb +13 -0
  93. data/stdlib/nashorn/io.rb +2 -0
  94. data/stdlib/native.rb +12 -4
  95. data/stdlib/nodejs/io.rb +5 -2
  96. data/stdlib/opal/platform.rb +19 -0
  97. data/stdlib/phantomjs.rb +4 -0
  98. data/stdlib/strscan.rb +1 -1
  99. data/tasks/building.rake +2 -1
  100. data/tasks/testing.rake +29 -34
  101. data/tasks/testing/{phantomjs1-sprockets.js → sprockets-phantomjs.js} +2 -20
  102. data/vendored-minitest/minitest/test.rb +7 -15
  103. metadata +32 -9
  104. data/lib/mspec/opal/main.rb.erb +0 -9
@@ -38,11 +38,11 @@ class Struct
38
38
  members << name
39
39
 
40
40
  define_method name do
41
- self[name]
41
+ `self.$$data[name]`
42
42
  end
43
43
 
44
44
  define_method "#{name}=" do |value|
45
- self[name] = value
45
+ `self.$$data[name] = value`
46
46
  end
47
47
  end
48
48
 
@@ -83,7 +83,11 @@ class Struct
83
83
 
84
84
  name = members[name]
85
85
  elsif String === name
86
- raise NameError.new("no member '#{name}' in struct", name) unless members.include?(name.to_sym)
86
+ %x{
87
+ if(!self.$$data.hasOwnProperty(name)) {
88
+ #{raise NameError.new("no member '#{name}' in struct", name)}
89
+ }
90
+ }
87
91
  else
88
92
  raise TypeError, "no implicit conversion of #{name.class} into Integer"
89
93
  end
@@ -1,17 +1,14 @@
1
1
  opal_filter "Array" do
2
2
  fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array"
3
3
  fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined"
4
- fails "Array#flatten with a non-Array object in the Array calls #to_ary if not defined when #respond_to_missing? returns true"
5
- fails "Array#flatten with a non-Array object in the Array does not call #to_ary if not defined when #respond_to_missing? returns false"
6
4
  fails "Array#join raises a NoMethodError if an element does not respond to #to_str, #to_ary, or #to_s"
7
5
  fails "Array#partition returns in the left array values for which the block evaluates to true"
8
6
  fails "Array#permutation when no block is given returned Enumerator size with an array size greater than 0 returns the descending factorial of array size and given length"
9
7
  fails "Array#permutation when no block is given returned Enumerator size with an array size greater than 0 returns the descending factorial of array size with array size when there's no param"
10
8
  fails "Array#permutation when no block is given returned Enumerator size with an empty array returns 1 when the given length is 0"
11
9
  fails "Array#permutation when no block is given returned Enumerator size with an empty array returns 1 when there's param"
12
- fails "Array#pop passed a number n as an argument raises an ArgumentError if more arguments are passed" #Arity issue?
13
- fails "Array#rassoc calls elem == obj on the second element of each contained array" #Spec assumes string and symbols are not equal.
14
- fails "Array#rassoc does not check the last element in each contained but speficically the second" #Spec assumes string and symbols are not equal.
10
+ fails "Array#rassoc calls elem == obj on the second element of each contained array"
11
+ fails "Array#rassoc does not check the last element in each contained but speficically the second"
15
12
  fails "Array#repeated_combination accepts sizes larger than the original array"
16
13
  fails "Array#repeated_combination generates from a defensive copy, ignoring mutations"
17
14
  fails "Array#repeated_combination returns an enumerator when no block is provided"
@@ -19,11 +16,11 @@ opal_filter "Array" do
19
16
  fails "Array#repeated_combination when no block is given returned Enumerator size returns 0 when the combination_size is < 0"
20
17
  fails "Array#repeated_combination when no block is given returned Enumerator size returns 1 when the combination_size is 0"
21
18
  fails "Array#repeated_combination when no block is given returned Enumerator size returns the binomial coeficient between combination_size and array size + combination_size -1"
19
+ fails "Array#repeated_combination yields [] when length is 0"
22
20
  fails "Array#repeated_combination yields a partition consisting of only singletons"
23
21
  fails "Array#repeated_combination yields nothing for negative length and return self"
24
22
  fails "Array#repeated_combination yields nothing when the array is empty and num is non zero"
25
23
  fails "Array#repeated_combination yields the expected repeated_combinations"
26
- fails "Array#repeated_combination yields [] when length is 0"
27
24
  fails "Array#repeated_permutation allows permutations larger than the number of elements"
28
25
  fails "Array#repeated_permutation does not yield when called on an empty Array with a nonzero argument"
29
26
  fails "Array#repeated_permutation generates from a defensive copy, ignoring mutations"
@@ -35,8 +32,7 @@ opal_filter "Array" do
35
32
  fails "Array#repeated_permutation when no block is given returned Enumerator size returns array size ** combination_size"
36
33
  fails "Array#repeated_permutation yields all repeated_permutations to the block then returns self when called with block but no arguments"
37
34
  fails "Array#repeated_permutation yields the empty repeated_permutation ([[]]) when the given length is 0"
38
- fails "Array#select returns a new array of elements for which block is true" #Spec assumes integer division
39
- fails "Array#shift passed a number n as an argument raises an ArgumentError if more arguments are passed" #Arity issue?
35
+ fails "Array#select returns a new array of elements for which block is true"
40
36
  fails "Array#slice! calls to_int on range arguments"
41
37
  fails "Array#slice! calls to_int on start and length arguments"
42
38
  fails "Array#slice! does not expand array with indices out of bounds"
@@ -54,6 +50,5 @@ opal_filter "Array" do
54
50
  fails "Array#sort_by! when no block is given returned Enumerator size returns the enumerable size"
55
51
  fails "Array#uniq! properly handles recursive arrays"
56
52
  fails "Array#zip fills nil when the given enumereator is shorter than self"
57
- fails "Array#zip stops at own size when given an infinite enumerator"
58
53
  fails "Array.[] can unpack 2 or more nested referenced array"
59
54
  end
@@ -1,33 +1,19 @@
1
1
  opal_filter "BasicObject" do
2
2
  fails "BasicObject does not define built-in constants (according to const_defined?)"
3
3
  fails "BasicObject does not define built-in constants (according to defined?)"
4
- fails "BasicObject instance metaclass contains methods defined for the BasicObject instance"
5
- fails "BasicObject instance metaclass has BasicObject as superclass"
6
- fails "BasicObject instance metaclass is an instance of Class"
7
4
  fails "BasicObject metaclass contains methods for the BasicObject class"
8
5
  fails "BasicObject metaclass has Class as superclass"
9
6
  fails "BasicObject raises NameError when referencing built-in constants"
10
7
  fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed"
8
+ fails "BasicObject#__send__ has a negative arity"
11
9
  fails "BasicObject#initialize does not accept arguments"
12
- fails "BasicObject#instance_eval binds self to the receiver"
13
- fails "BasicObject#instance_eval evaluates strings"
14
- fails "BasicObject#instance_eval executes in the context of the receiver"
15
- fails "BasicObject#instance_eval gets constants in the receiver if a string given"
16
- fails "BasicObject#instance_eval has access to receiver's instance variables"
17
- fails "BasicObject#instance_eval makes the receiver metaclass the scoped class when used with a string"
18
10
  fails "BasicObject#instance_eval raises a TypeError when defining methods on an immediate"
19
11
  fails "BasicObject#instance_eval raises a TypeError when defining methods on numerics"
20
12
  fails "BasicObject#instance_eval sets class variables in the receiver"
21
- fails "BasicObject#instance_eval treats block-local variables as local to the block"
22
13
  fails "BasicObject#instance_exec binds the block's binding self to the receiver"
23
14
  fails "BasicObject#instance_exec has an arity of -1"
24
15
  fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
25
16
  fails "BasicObject#instance_exec raises a TypeError when defining methods on an immediate"
26
17
  fails "BasicObject#instance_exec raises a TypeError when defining methods on numerics"
27
18
  fails "BasicObject#instance_exec sets class variables in the receiver"
28
- fails "BasicObject#__send__ has a negative arity"
29
- fails "Kernel#public_send has a negative arity"
30
- fails "Kernel#send has a negative arity"
31
- fails "Module#prepend does not affect the superclass"
32
- fails "Module#singleton_class? returns true for singleton classes"
33
19
  end
@@ -1,12 +1,4 @@
1
1
  opal_filter "Date" do
2
- fails "Date constants defines ABBR_MONTHNAMES"
3
- fails "Date constants defines DAYNAMES"
4
- fails "Date constants defines ENGLAND"
5
- fails "Date constants defines GREGORIAN"
6
- fails "Date constants defines ITALY"
7
- fails "Date constants defines JULIAN"
8
- fails "Date constants defines MONTHNAMES"
9
- fails "Date constants freezes MONTHNAMES, DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES"
10
2
  fails "Date#<< raises an error on non numeric parameters"
11
3
  fails "Date#<=> returns -1 when self is less than a Numeric"
12
4
  fails "Date#<=> returns 1 when self is greater than a Numeric"
@@ -14,9 +6,7 @@ opal_filter "Date" do
14
6
  fails "Date#>> returns the day of the reform if date falls within calendar reform"
15
7
  fails "Date#ajd determines the Astronomical Julian day"
16
8
  fails "Date#amjd determines the Astronomical Modified Julian day"
17
- fails "Date#civil creates a Date for -4712 by default"
18
9
  fails "Date#civil creates a Date for different calendar reform dates"
19
- fails "Date#civil creates a date with arguments"
20
10
  fails "Date#civil doesn't create dates for invalid arguments"
21
11
  fails "Date#commercial creates a Date for Julian Day Number day 0 by default"
22
12
  fails "Date#commercial Creates a Date for the correct day given the year, week and day number"
@@ -35,9 +25,7 @@ opal_filter "Date" do
35
25
  fails "Date#gregorian_leap? returns true if a year is a leap year in the Gregorian calendar"
36
26
  fails "Date#hash returns the same value for equal dates"
37
27
  fails "Date#italy converts a date object into another with the Italian calendar reform"
38
- fails "Date#jd determines the Julian day for a Date object"
39
28
  fails "Date#julian converts a date object into another with the Julian calendar"
40
- fails "Date#julian? marks a day after the calendar reform as Julian"
41
29
  fails "Date#julian? marks a day before the calendar reform as Julian"
42
30
  fails "Date#ld determines the Modified Julian day"
43
31
  fails "Date#mday determines the day of the month"
@@ -56,6 +44,10 @@ opal_filter "Date" do
56
44
  fails "Date#parse parses YYYYDDD as year and day number"
57
45
  fails "Date#parse parses YYYYMMDD as year, month and day number"
58
46
  fails "Date#parse throws an argument error for a single digit"
47
+ fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object NOT using the year digits as 20XX"
48
+ fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object using the year digits as 20XX"
49
+ fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object"
50
+ fails "Date#parse with '-' separator EU-style can parse a MM-DD-YYYY string into a Date object"
59
51
  fails "Date#parse with ' ' separator can handle negative year numbers"
60
52
  fails "Date#parse with ' ' separator can parse a 'DD mmm YYYY' string into a Date object"
61
53
  fails "Date#parse with ' ' separator can parse a 'mmm DD YYYY' string into a Date object"
@@ -65,10 +57,6 @@ opal_filter "Date" do
65
57
  fails "Date#parse with ' ' separator can parse a month name, day and year into a Date object"
66
58
  fails "Date#parse with ' ' separator can parse a year, day and month name into a Date object"
67
59
  fails "Date#parse with ' ' separator can parse a year, month name and day into a Date object"
68
- fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object NOT using the year digits as 20XX"
69
- fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object using the year digits as 20XX"
70
- fails "Date#parse with '-' separator EU-style can parse a MM-DD-YY string into a Date object"
71
- fails "Date#parse with '-' separator EU-style can parse a MM-DD-YYYY string into a Date object"
72
60
  fails "Date#parse with '.' separator can handle negative year numbers"
73
61
  fails "Date#parse with '.' separator can parse a 'DD mmm YYYY' string into a Date object"
74
62
  fails "Date#parse with '.' separator can parse a 'mmm DD YYYY' string into a Date object"
@@ -151,9 +139,7 @@ opal_filter "Date" do
151
139
  fails "Date.jd returns a Date object representing Julian day 0 (-4712-01-01) if no arguments passed"
152
140
  fails "Date.julian_leap? determines whether a year is a leap year in the Julian calendar"
153
141
  fails "Date.julian_leap? determines whether a year is not a leap year in the Julian calendar"
154
- fails "Date.new creates a Date for -4712 by default"
155
142
  fails "Date.new creates a Date for different calendar reform dates"
156
- fails "Date.new creates a date with arguments"
157
143
  fails "Date.new doesn't create dates for invalid arguments"
158
144
  fails "Date.ordinal constructs a Date object from an ordinal date"
159
145
  fails "Date.valid_jd? returns false if passed nil"
@@ -161,12 +147,4 @@ opal_filter "Date" do
161
147
  fails "Date.valid_jd? returns true if passed false"
162
148
  fails "Date.valid_ordinal? determines if the date is a valid ordinal date"
163
149
  fails "Date.valid_ordinal? handles negative day numbers"
164
- fails "Date::Infinity should be able to check whether Infinity is finite"
165
- fails "Date::Infinity should be able to check whether Infinity is infinite"
166
- fails "Date::Infinity should be able to check whether Infinity is not a number"
167
- fails "Date::Infinity should be able to check whether Infinity is zero"
168
- fails "Date::Infinity should be able to coerce a Date::Infinity object"
169
- fails "Date::Infinity should be able to compare Infinity objects"
170
- fails "Date::Infinity should be able to return plus Infinity for abs"
171
- fails "Date::Infinity should be able to use -@ and +@ for Date::Infinity"
172
150
  end
@@ -5,6 +5,22 @@ opal_filter "Enumerable" do
5
5
  fails "Enumerable#each_entry passes through the values yielded by #each_with_index"
6
6
  fails "Enumerable#each_entry returns an enumerator if no block"
7
7
  fails "Enumerable#each_entry yields multiple arguments as an array"
8
+ fails "Enumerable#max that is nil returns the maximum element"
9
+ fails "Enumerable#max when called with an argument n on a enumerable of length x where x < n returns an array containing the maximum n elements of length x"
10
+ fails "Enumerable#max when called with an argument n with a block returns an array containing the maximum n elements"
11
+ fails "Enumerable#max when called with an argument n without a block returns an array containing the maximum n elements"
12
+ fails "Enumerable#max_by when called with an argument n when n is nil returns the maximum element"
13
+ fails "Enumerable#max_by when called with an argument n with a block on a enumerable of length x where x < n returns an array containing the maximum n elements of length n"
14
+ fails "Enumerable#max_by when called with an argument n with a block returns an array containing the maximum n elements based on the block's value"
15
+ fails "Enumerable#max_by when called with an argument n without a block returns an enumerator"
16
+ fails "Enumerable#min that is nil returns the minimum element"
17
+ fails "Enumerable#min when called with an argument n on a enumerable of length x where x < n returns an array containing the minimum n elements of length x"
18
+ fails "Enumerable#min when called with an argument n with a block returns an array containing the minimum n elements"
19
+ fails "Enumerable#min when called with an argument n without a block returns an array containing the minimum n elements"
20
+ fails "Enumerable#min_by when called with an argument n when n is nil returns the minimum element"
21
+ fails "Enumerable#min_by when called with an argument n with a block on a enumerable of length x where x < n returns an array containing the minimum n elements of length n"
22
+ fails "Enumerable#min_by when called with an argument n with a block returns an array containing the minimum n elements based on the block's value"
23
+ fails "Enumerable#min_by when called with an argument n without a block returns an enumerator"
8
24
  fails "Enumerable#minmax_by Enumerable with no size when no block is given returned Enumerator size returns nil"
9
25
  fails "Enumerable#minmax_by Enumerable with size when no block is given returned Enumerator size returns the enumerable size"
10
26
  fails "Enumerable#minmax_by gathers whole arrays as elements when each yields multiple"
@@ -15,6 +31,16 @@ opal_filter "Enumerable" do
15
31
  fails "Enumerable#minmax_by returns the object that appears first in #each in case of a tie"
16
32
  fails "Enumerable#minmax_by uses min/max.<=>(current) to determine order"
17
33
  fails "Enumerable#reverse_each gathers whole arrays as elements when each yields multiple"
34
+ fails "Enumerable#slice_after raises an ArgumentError when given an incorrect number of arguments"
35
+ fails "Enumerable#slice_after when given a block and an argument raises an ArgumentError"
36
+ fails "Enumerable#slice_after when given a block and no argument calls the block to determine when to yield"
37
+ fails "Enumerable#slice_after when given an argument and no block calls === on the argument to determine when to yield"
38
+ fails "Enumerable#slice_after when given an argument and no block doesn't yield an empty array if the filter matches the first entry or the last entry"
39
+ fails "Enumerable#slice_after when given an argument and no block uses standard boolean as a test"
40
+ fails "Enumerable#slice_when when given a block calls the block for length of the receiver enumerable minus one times"
41
+ fails "Enumerable#slice_when when given a block returns an enumerator"
42
+ fails "Enumerable#slice_when when given a block splits chunks between adjacent elements i and j where the block returns true"
43
+ fails "Enumerable#slice_when when not given a block raises an ArgumentError"
18
44
  fails "Enumerable#sort compare values returned by block with 0"
19
45
  fails "Enumerable#sort raises an error if objects can't be compared"
20
46
  fails "Enumerable#take_while calls the block with initial args when yielded with multiple arguments"
@@ -28,5 +54,4 @@ opal_filter "Enumerable" do
28
54
  fails "Enumerable#zip converts arguments to enums using #to_enum"
29
55
  fails "Enumerable#zip gathers whole arrays as elements when each yields multiple"
30
56
  fails "Enumerable#zip passes each element of the result array to a block and return nil if a block is given"
31
- fails "Enumerator#size returns the result from size.call if the size respond to call "
32
57
  end
@@ -1,11 +1,9 @@
1
1
  opal_filter "Enumerator" do
2
- fails "#enum_for exposes multi-arg yields as an array"
3
- fails "#to_enum exposes multi-arg yields as an array"
4
- fails "Enumerator#each requires multiple arguments" # arity issue
5
- fails "Enumerator#each_with_index passes on the given block's return value"
2
+ fails "Enumerator#each requires multiple arguments"
6
3
  fails "Enumerator#each_with_index raises an ArgumentError if passed extra arguments"
7
4
  fails "Enumerator#each_with_index returns the iterator's return value"
8
5
  fails "Enumerator#each_with_index returns the object being enumerated when given a block"
6
+ fails "Enumerator#enum_for exposes multi-arg yields as an array"
9
7
  fails "Enumerator#feed can be called for each iteration"
10
8
  fails "Enumerator#feed causes yield to return the value if called during iteration"
11
9
  fails "Enumerator#feed raises a TypeError if called more than once without advancing the enumerator"
@@ -42,4 +40,6 @@ opal_filter "Enumerator" do
42
40
  fails "Enumerator#peek_values returns the next element in self"
43
41
  fails "Enumerator#peek_values works in concert with #rewind"
44
42
  fails "Enumerator#size returns returning value from size.call if set size is a Proc"
43
+ fails "Enumerator#size returns the result from size.call if the size respond to call"
44
+ fails "Enumerator#to_enum exposes multi-arg yields as an array"
45
45
  end
@@ -1,13 +1,11 @@
1
1
  opal_filter "Exception" do
2
- fails "ArgumentError gives its own class name as message if it has no message"
3
2
  fails "Errno::EAGAIN is the same class as Errno::EWOULDBLOCK if they represent the same errno value"
4
- fails "Errno::EINVAL.new accepts an optional custom message and location"
5
3
  fails "Errno::EINVAL.new accepts an optional custom message"
4
+ fails "Errno::EINVAL.new accepts an optional custom message and location"
6
5
  fails "Errno::EINVAL.new can be called with no arguments"
7
6
  fails "Errno::EMFILE can be subclassed"
8
7
  fails "Exception is a superclass of EncodingError"
9
8
  fails "Exception is a superclass of Interrupt"
10
- fails "Exception is a superclass of SecurityError"
11
9
  fails "Exception is a superclass of SystemStackError"
12
10
  fails "Exception#== returns false if the two exceptions differ only in their backtrace"
13
11
  fails "Exception#== returns false if the two exceptions differ only in their message"
@@ -23,9 +21,7 @@ opal_filter "Exception" do
23
21
  fails "Exception#backtrace includes the line number of the location immediately prior to where self raised in the second element"
24
22
  fails "Exception#backtrace includes the line number of the location where self raised in the first element"
25
23
  fails "Exception#backtrace includes the name of the method from where self raised in the first element"
26
- fails "Exception#backtrace returns an Array"
27
24
  fails "Exception#backtrace returns nil if no backtrace was set"
28
- fails "Exception#backtrace sets each element to a String"
29
25
  fails "Exception#set_backtrace accepts a String"
30
26
  fails "Exception#set_backtrace accepts an Array of Strings"
31
27
  fails "Exception#set_backtrace accepts an empty Array"
@@ -48,9 +44,7 @@ opal_filter "Exception" do
48
44
  fails "SignalException.new takes a signal symbol with SIG prefix as the first argument"
49
45
  fails "SignalException.new takes a signal symbol without SIG prefix as the first argument"
50
46
  fails "SignalException.new takes an optional message argument with a signal number"
51
- fails "StandardError is a superclass of ZeroDivisionError"
52
47
  fails "StopIteration#result returns the method-returned-object from an Enumerator"
53
- fails "SystemCallError can be subclassed"
54
48
  fails "SystemCallError#errno returns nil when no errno given"
55
49
  fails "SystemCallError#errno returns the errno given as optional argument to new"
56
50
  fails "SystemCallError#message returns the default message when no message is given"
@@ -1,5 +1,19 @@
1
1
  opal_filter "Float" do
2
2
  fails "Float#divmod returns an [quotient, modulus] from dividing self by other" # precision errors caused by Math.frexp and Math.ldexp
3
+ fails "Float#next_float returns a float the smallest possible step greater than the receiver"
4
+ fails "Float#next_float returns NAN if NAN was the receiver"
5
+ fails "Float#next_float returns negative zero when stepping upward from just below zero"
6
+ fails "Float#next_float reverses the effect of prev_float"
7
+ fails "Float#next_float steps directly between -1.0 and -1.0 + EPSILON/2"
8
+ fails "Float#next_float steps directly between 1.0 and 1.0 + EPSILON"
9
+ fails "Float#next_float steps directly between MAX and INFINITY"
10
+ fails "Float#prev_float returns a float the smallest possible step smaller than the receiver"
11
+ fails "Float#prev_float returns NAN if NAN was the receiver"
12
+ fails "Float#prev_float returns positive zero when stepping downward from just above zero"
13
+ fails "Float#prev_float reverses the effect of next_float"
14
+ fails "Float#prev_float steps directly between -1.0 and -1.0 - EPSILON"
15
+ fails "Float#prev_float steps directly between 1.0 and 1.0 - EPSILON/2"
16
+ fails "Float#prev_float steps directly between MAX and INFINITY"
3
17
  fails "Float#rationalize returns self as a simplified Rational with no argument" # precision errors caused by Math.frexp and Math.ldexp
4
18
  fails "Float#to_i returns self truncated to an Integer"
5
19
  fails "Float#to_int returns self truncated to an Integer"
@@ -7,9 +7,7 @@ opal_filter "Hash" do
7
7
  fails "Hash#eql? compares keys with eql? semantics" # spec relies on integer and float being different
8
8
  fails "Hash#eql? computes equality for complex recursive hashes"
9
9
  fails "Hash#eql? computes equality for recursive hashes & arrays"
10
- fails "Hash#fetch raises an ArgumentError when not passed one or two arguments" # arity issue?
11
10
  fails "Hash#invert compares new keys with eql? semantics" # spec relies on integer and float being different
12
11
  fails "Hash#[] compares keys with eql? semantics" # spec relies on integer and float being different
13
12
  fails "Hash#[] does not create copies of the immediate default value" # spec uses mutable string
14
- fails "Hash.new raises an ArgumentError if more than one argument is passed" # arity issue?
15
13
  end
@@ -20,9 +20,9 @@ opal_filter "Integer" do
20
20
  fails "Integer#chr without argument when Encoding.default_internal is not nil and self is greater than 255 returns a String encoding self interpreted as a codepoint in the default internal encoding"
21
21
  fails "Integer#chr without argument when Encoding.default_internal is not nil and self is greater than 255 returns a String with the default internal encoding"
22
22
  fails "Integer#gcdlcm raises a TypeError unless the argument is an Integer"
23
+ fails "Integer#gcdlcm returns [self, self] if self is equal to the argument"
23
24
  fails "Integer#gcdlcm returns a two-element Array"
24
25
  fails "Integer#gcdlcm returns an Array"
25
26
  fails "Integer#gcdlcm returns the greatest common divisor of self and argument as the first element"
26
27
  fails "Integer#gcdlcm returns the least common multiple of self and argument as the last element"
27
- fails "Integer#gcdlcm returns [self, self] if self is equal to the argument"
28
28
  end
@@ -1,9 +1,14 @@
1
1
  opal_filter "Kernel" do
2
2
  fails "Kernel#=~ returns nil matching any object"
3
- fails "Kernel#Array does not call #to_a on an Array" #something funky with the spec itself
3
+ fails "Kernel#Array does not call #to_a on an Array"
4
+ fails "Kernel#String calls #to_s if #respond_to?(:to_s) returns true"
5
+ fails "Kernel#String raises a TypeError if #to_s does not exist"
6
+ fails "Kernel#String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true"
7
+ fails "Kernel#String raises a TypeError if respond_to? returns false for #to_s"
8
+ fails "Kernel#__dir__ returns the real name of the directory containing the currently-executing file"
9
+ fails "Kernel#__dir__ when used in eval with top level binding returns the real name of the directory containing the currently-executing file"
4
10
  fails "Kernel#block_given? is a private method"
5
11
  fails "Kernel#class returns the class of the object"
6
- fails "Kernel#clone copies modules included in the singleton class"
7
12
  fails "Kernel#define_singleton_method when given an UnboundMethod will raise when attempting to define an object's singleton method from another object's singleton method"
8
13
  fails "Kernel#dup does not copy constants defined in the singleton class"
9
14
  fails "Kernel#eval allows a binding to be captured inside an eval"
@@ -29,35 +34,37 @@ opal_filter "Kernel" do
29
34
  fails "Kernel#eval uses the filename of the binding if none is provided"
30
35
  fails "Kernel#eval uses the receiver as self inside the eval"
31
36
  fails "Kernel#eval uses the same scope for local variables when given the same binding"
32
- fails "Kernel#Float raises a RangeError when passed a Complex argument"
33
- fails "Kernel#Float returns a Float for Complex with only a real part"
37
+ fails "Kernel#extend calls extend_object on argument"
38
+ fails "Kernel#extend does not calls append_features on arguments metaclass"
39
+ fails "Kernel#extend makes the class a kind_of? the argument"
40
+ fails "Kernel#extend on frozen instance raises a RuntimeError"
41
+ fails "Kernel#extend on frozen instance raises an ArgumentError when no arguments given"
42
+ fails "Kernel#extend raises an ArgumentError when no arguments given"
43
+ fails "Kernel#extend requires multiple arguments"
34
44
  fails "Kernel#freeze causes instance_variable_set to raise RuntimeError"
35
45
  fails "Kernel#freeze causes mutative calls to raise RuntimeError"
36
46
  fails "Kernel#freeze on a Float has no effect since it is already frozen"
37
47
  fails "Kernel#freeze on integers has no effect since they are already frozen"
38
- fails "Kernel#freeze on true, false and nil actually freezes them"
48
+ fails "Kernel#freeze on true, false and nil has no effect since they are already frozen"
39
49
  fails "Kernel#frozen? on a Float returns true"
40
50
  fails "Kernel#frozen? on integers returns true"
51
+ fails "Kernel#frozen? on true, false and nil returns true"
41
52
  fails "Kernel#inspect does not call #to_s if it is defined"
42
53
  fails "Kernel#inspect returns a tainted string if self is tainted"
43
54
  fails "Kernel#inspect returns an untrusted string if self is untrusted"
44
- fails "Kernel#instance_variables immediate values returns the correct array if an instance variable is added"
45
- fails "Kernel#instance_variables regular objects returns an empty array if no instance variables are defined"
46
- fails "Kernel#instance_variables regular objects returns the correct array if an instance variable is added"
47
55
  fails "Kernel#instance_variable_set on frozen objects keeps stored object after any exceptions"
48
56
  fails "Kernel#instance_variable_set on frozen objects raises a RuntimeError when passed replacement is different from stored object"
49
57
  fails "Kernel#instance_variable_set on frozen objects raises a RuntimeError when passed replacement is identical to stored object"
50
- fails "Kernel#is_a? raises a TypeError if given an object that is not a Class nor a Module"
58
+ fails "Kernel#instance_variables immediate values returns the correct array if an instance variable is added"
51
59
  fails "Kernel#is_a? returns true if given a Module that object has been extended with"
52
60
  fails "Kernel#iterator? is a private method"
53
- fails "Kernel#kind_of? raises a TypeError if given an object that is not a Class nor a Module"
61
+ fails "Kernel#itself returns the receiver itself"
54
62
  fails "Kernel#kind_of? returns true if given a Module that object has been extended with"
55
63
  fails "Kernel#local_variables contains locals as they are added"
56
64
  fails "Kernel#local_variables is a private method"
57
65
  fails "Kernel#local_variables is accessible from bindings"
58
66
  fails "Kernel#local_variables is accessible in eval"
59
67
  fails "Kernel#method can be called even if we only repond_to_missing? method, true"
60
- fails "Kernel#method raises a NameError for an invalid singleton method name"
61
68
  fails "Kernel#method returns a method object if we repond_to_missing? method"
62
69
  fails "Kernel#method will see an alias of the original method as == when in a derived class"
63
70
  fails "Kernel#methods returns private singleton methods defined by obj.meth"
@@ -106,22 +113,15 @@ opal_filter "Kernel" do
106
113
  fails "Kernel#public_methods returns a list of the names of publicly accessible methods in the object"
107
114
  fails "Kernel#public_methods when passed false returns a list of public methods in without its ancestors"
108
115
  fails "Kernel#public_methods when passed nil returns a list of public methods in without its ancestors"
109
- fails "Kernel#public_send raises a NameError if the corresponding singleton method can't be found"
116
+ fails "Kernel#public_send has a negative arity"
110
117
  fails "Kernel#public_send raises a NoMethodError if the method is protected"
111
118
  fails "Kernel#public_send raises a NoMethodError if the named method is an alias of a private method"
112
119
  fails "Kernel#public_send raises a NoMethodError if the named method is an alias of a protected method"
113
120
  fails "Kernel#public_send raises a NoMethodError if the named method is private"
114
121
  fails "Kernel#puts delegates to $stdout.puts"
115
122
  fails "Kernel#puts is a private method"
116
- fails "Kernel#remove_instance_variable is a public method"
117
- fails "Kernel#remove_instance_variable raises a TypeError if passed an Object not defining #to_str"
118
- fails "Kernel#remove_instance_variable when passed a String removes the instance variable"
119
- fails "Kernel#remove_instance_variable when passed a String returns the instance variable's value"
120
- fails "Kernel#remove_instance_variable when passed a Symbol removes the instance variable"
121
- fails "Kernel#remove_instance_variable when passed a Symbol returns the instance variable's value"
122
- fails "Kernel#remove_instance_variable when passed an Object calls #to_str to convert the argument"
123
+ fails "Kernel#raise raises RuntimeError if no exception class is given"
123
124
  fails "Kernel#respond_to? does not change method visibility when finding private method"
124
- fails "Kernel#respond_to? is a public method"
125
125
  fails "Kernel#respond_to? is only an instance method"
126
126
  fails "Kernel#respond_to? returns false even if obj responds to the given private method (include_private = false)"
127
127
  fails "Kernel#respond_to? returns false if obj responds to the given private method"
@@ -145,7 +145,7 @@ opal_filter "Kernel" do
145
145
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given protected method, include_private = true"
146
146
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given public method"
147
147
  fails "Kernel#respond_to_missing? isn't called when obj responds to the given public method, include_private = true"
148
- fails "Kernel#send raises a NameError if the corresponding singleton method can't be found"
148
+ fails "Kernel#send has a negative arity"
149
149
  fails "Kernel#singleton_class raises TypeError for Fixnum"
150
150
  fails "Kernel#singleton_class raises TypeError for Symbol"
151
151
  fails "Kernel#singleton_methods when not passed an argument does not return any included methods for a class including a module"
@@ -230,26 +230,36 @@ opal_filter "Kernel" do
230
230
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with a module"
231
231
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object extented with two modules"
232
232
  fails "Kernel#singleton_methods when passed true returns the names of singleton methods for an object"
233
- fails "Kernel#String calls #to_s if #respond_to?(:to_s) returns true"
234
- fails "Kernel#String raises a TypeError if #to_s does not exist"
235
- fails "Kernel#String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true"
236
- fails "Kernel#String raises a TypeError if respond_to? returns false for #to_s"
237
233
  fails "Kernel#warn requires multiple arguments"
238
- fails "Kernel#__dir__ returns the real name of the directory containing the currently-executing file"
239
- fails "Kernel#__dir__ when used in eval with top level binding returns the real name of the directory containing the currently-executing file"
240
- fails "Kernel.Array does not call #to_a on an Array" #something funky with the spec itself
241
- fails "Kernel.Complex() when passed a non-Numeric second argument raises TypeError"
242
- fails "Kernel.Complex() when passed a Numeric which responds to #real? with false returns the passed argument"
243
- fails "Kernel.Complex() when passed a Numeric which responds to #real? with true returns a Complex with the passed argument as the real component and 0 as the imaginary component"
244
- fails "Kernel.Complex() when passed a single non-Numeric coerces the passed argument using #to_c"
234
+ fails "Kernel.Array does not call #to_a on an Array"
245
235
  fails "Kernel.Complex() when passed Numerics n1 and n2 and at least one responds to #real? with false returns n1 + n2 * Complex(0, 1)"
246
- fails "Kernel.Complex() when passed two Numerics and both respond to #real? with true returns a Complex with the passed arguments as real and imaginary components respectively"
247
236
  fails "Kernel.Complex() when passed [Complex, Complex] returns a new Complex number based on the two given numbers"
248
237
  fails "Kernel.Complex() when passed [Complex] returns the passed Complex number"
249
- fails "Kernel.Complex() when passed [Integer, Integer] returns a new Complex number"
250
- fails "Kernel.Complex() when passed [Integer] returns a new Complex number with 0 as the imaginary component"
251
- fails "Kernel.Float raises a RangeError when passed a Complex argument"
252
- fails "Kernel.Float returns a Float for Complex with only a real part"
238
+ fails "Kernel.Complex() when passed a Numeric which responds to #real? with false returns the passed argument"
239
+ fails "Kernel.Complex() when passed a non-Numeric second argument raises TypeError"
240
+ fails "Kernel.Complex() when passed a single non-Numeric coerces the passed argument using #to_c"
241
+ fails "Kernel.Rational when passed a String converts the String to a Rational using the same method as String#to_r"
242
+ fails "Kernel.Rational when passed a String does not use the same method as Float#to_r"
243
+ fails "Kernel.Rational when passed a String raises a TypeError if the first argument is a Symbol"
244
+ fails "Kernel.Rational when passed a String raises a TypeError if the second argument is a Symbol"
245
+ fails "Kernel.Rational when passed a String scales the Rational value of the first argument by the Rational value of the second"
246
+ fails "Kernel.Rational when passed a String when passed a Numeric calls #to_r to convert the first argument to a Rational"
247
+ fails "Kernel.String calls #to_s if #respond_to?(:to_s) returns true"
248
+ fails "Kernel.String raises a TypeError if #to_s does not exist"
249
+ fails "Kernel.String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true"
250
+ fails "Kernel.String raises a TypeError if respond_to? returns false for #to_s"
251
+ fails "Kernel.__callee__ returns method name even from eval"
252
+ fails "Kernel.__callee__ returns method name even from send"
253
+ fails "Kernel.__callee__ returns the aliased name when aliased method"
254
+ fails "Kernel.__callee__ returns the caller from a define_method called from the same class"
255
+ fails "Kernel.__callee__ returns the caller from block inside define_method too"
256
+ fails "Kernel.__callee__ returns the caller from blocks too"
257
+ fails "Kernel.__callee__ returns the caller from define_method too"
258
+ fails "Kernel.__method__ returns method name even from eval"
259
+ fails "Kernel.__method__ returns method name even from send"
260
+ fails "Kernel.__method__ returns the caller from block inside define_method too"
261
+ fails "Kernel.__method__ returns the caller from blocks too"
262
+ fails "Kernel.__method__ returns the caller from define_method too"
253
263
  fails "Kernel.global_variables finds subset starting with std"
254
264
  fails "Kernel.global_variables is a private method"
255
265
  fails "Kernel.lambda accepts 0 arguments when used with ||"
@@ -269,19 +279,6 @@ opal_filter "Kernel" do
269
279
  fails "Kernel.printf writes to stdout when a string is the first argument"
270
280
  fails "Kernel.proc is a private method"
271
281
  fails "Kernel.rand is a private method"
272
- fails "Kernel.Rational passed Integer returns a new Rational number with 1 as the denominator"
273
- fails "Kernel.Rational passed two integers reduces the Rational"
274
- fails "Kernel.Rational passed two integers returns a new Rational number"
275
- fails "Kernel.Rational when passed a String converts the String to a Rational using the same method as String#to_r"
276
- fails "Kernel.Rational when passed a String does not use the same method as Float#to_r"
277
- fails "Kernel.Rational when passed a String raises a TypeError if the first argument is a Symbol"
278
- fails "Kernel.Rational when passed a String raises a TypeError if the first argument is nil"
279
- fails "Kernel.Rational when passed a String raises a TypeError if the second argument is a Symbol"
280
- fails "Kernel.Rational when passed a String raises a TypeError if the second argument is nil"
281
- fails "Kernel.Rational when passed a String scales the Rational value of the first argument by the Rational value of the second"
282
- fails "Kernel.Rational when passed a String when passed a Complex raises a RangeError if the imaginary part is not 0"
283
- fails "Kernel.Rational when passed a String when passed a Complex returns a Rational from the real part if the imaginary part is 0"
284
- fails "Kernel.Rational when passed a String when passed a Numeric calls #to_r to convert the first argument to a Rational"
285
282
  fails "Kernel.srand accepts a Bignum as a seed"
286
283
  fails "Kernel.srand accepts a negative seed"
287
284
  fails "Kernel.srand accepts and uses a seed of 0"
@@ -289,22 +286,6 @@ opal_filter "Kernel" do
289
286
  fails "Kernel.srand is a private method"
290
287
  fails "Kernel.srand returns the previous seed value"
291
288
  fails "Kernel.srand seeds the RNG correctly and repeatably"
292
- fails "Kernel.String calls #to_s if #respond_to?(:to_s) returns true"
293
- fails "Kernel.String raises a TypeError if #to_s does not exist"
294
- fails "Kernel.String raises a TypeError if #to_s is not defined, even though #respond_to?(:to_s) returns true"
295
- fails "Kernel.String raises a TypeError if respond_to? returns false for #to_s"
296
- fails "Kernel.__callee__ returns method name even from eval"
297
- fails "Kernel.__callee__ returns method name even from send"
298
- fails "Kernel.__callee__ returns the aliased name when aliased method"
299
- fails "Kernel.__callee__ returns the caller from a define_method called from the same class"
300
- fails "Kernel.__callee__ returns the caller from block inside define_method too"
301
- fails "Kernel.__callee__ returns the caller from blocks too"
302
- fails "Kernel.__callee__ returns the caller from define_method too"
303
- fails "Kernel.__method__ returns method name even from eval"
304
- fails "Kernel.__method__ returns method name even from send"
305
- fails "Kernel.__method__ returns the caller from block inside define_method too"
306
- fails "Kernel.__method__ returns the caller from blocks too"
307
- fails "Kernel.__method__ returns the caller from define_method too"
308
289
  fails "self.send(:block_given?) returns false when a method defined by define_method is called with a block"
309
290
  fails "self.send(:block_given?) returns true if and only if a block is supplied"
310
291
  end