opal 0.8.0.beta1 → 0.8.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -11,12 +11,8 @@ describe Opal::Builder do
11
11
  end
12
12
 
13
13
  it 'respect #require_tree calls' do
14
- begin
15
- Opal.append_path(File.expand_path('..', __FILE__))
16
- expect(builder.build('fixtures/require_tree_test').to_s).to include('Opal.modules["fixtures/required_tree_test/required_file1"]')
17
- ensure
18
- Opal.instance_variable_set('@paths', nil)
19
- end
14
+ builder.append_paths(File.expand_path('..', __FILE__))
15
+ expect(builder.build('fixtures/require_tree_test').to_s).to include('Opal.modules["fixtures/required_tree_test/required_file1"]')
20
16
  end
21
17
 
22
18
  describe ':stubs' do
@@ -52,6 +48,16 @@ describe Opal::Builder do
52
48
  end
53
49
  end
54
50
 
51
+ describe 'dup' do
52
+ it 'duplicates internal structures' do
53
+ b2 = builder.dup
54
+ b2.should_not equal(builder)
55
+ [:stubs, :preload, :processors, :path_reader, :prerequired, :compiler_options, :processed].each do |m|
56
+ b2.send(m).should_not equal(builder.send(m))
57
+ end
58
+ end
59
+ end
60
+
55
61
  describe 'requiring a native .js file' do
56
62
  it 'can be required without specifying extension' do
57
63
  builder.build_str('require "corelib/runtime"', 'foo')
data/spec/lib/cli_spec.rb CHANGED
@@ -82,12 +82,12 @@ describe Opal::CLI do
82
82
  let(:options) { {:gems => [gem_name], :evals => ['']} }
83
83
 
84
84
  it "adds the gem's lib paths to Opal.path" do
85
- cli.run
85
+ builder = cli.build
86
86
 
87
87
  spec = Gem::Specification.find_by_name(gem_name)
88
88
  spec.require_paths.each do |require_path|
89
89
  require_path = File.join(spec.gem_dir, require_path)
90
- expect(Opal.paths).to include(require_path)
90
+ expect(builder.path_reader.send(:file_finder).paths).to include(require_path)
91
91
  end
92
92
  end
93
93
  end
@@ -20,5 +20,17 @@ describe Opal::PathReader do
20
20
  include_examples :path_finder
21
21
  include_examples :path_reader do
22
22
  let(:path_reader) { file_reader }
23
+
24
+ it 'works with absolute paths' do
25
+ expect(path_reader.read(File.expand_path(__FILE__))).not_to be_nil
26
+ end
27
+
28
+ it 'works with relative paths starting with ./' do
29
+ expect(path_reader.read('./spec/lib/shared/path_reader_shared.rb')).not_to be_nil
30
+ end
31
+
32
+ it 'works with absolute paths' do
33
+ expect(path_reader.read("../#{File.basename(Dir.pwd)}/spec/lib/shared/path_reader_shared.rb")).not_to be_nil
34
+ end
23
35
  end
24
36
  end
@@ -45,13 +45,13 @@ describe Opal::Server do
45
45
  get '/assets/source_map.js'
46
46
  expect(last_response).to be_ok
47
47
 
48
- get maps_prefix+'/source_map.map'
48
+ get maps_prefix+'/source_map.self.map'
49
49
  expect(last_response).to be_ok
50
50
  end
51
51
 
52
52
  it 'serves map on a subfolder file' do
53
- js_path = '/assets/source_map/subfolder/other_file.js'
54
- map_path = maps_prefix+'/source_map/subfolder/other_file.map'
53
+ js_path = '/assets/source_map/subfolder/other_file.self.js'
54
+ map_path = maps_prefix+'/source_map/subfolder/other_file.self.map'
55
55
 
56
56
  get js_path
57
57
 
@@ -59,13 +59,13 @@ describe Opal::Server do
59
59
  received_map_path = extract_map_path(last_response)
60
60
  expect(expand_path(received_map_path, js_path+'/..')).to eq(map_path)
61
61
 
62
- get maps_prefix+'/source_map/subfolder/other_file.map'
62
+ get maps_prefix+'/source_map/subfolder/other_file.self.map'
63
63
  expect(last_response).to be_ok
64
64
  end
65
65
 
66
66
  it 'serves map on a subfolder file' do
67
- js_path = '/assets/source_map/subfolder/other_file.js'
68
- map_path = maps_prefix+'/source_map/subfolder/other_file.map'
67
+ js_path = '/assets/source_map/subfolder/other_file.self.js'
68
+ map_path = maps_prefix+'/source_map/subfolder/other_file.self.map'
69
69
 
70
70
  get js_path
71
71
 
@@ -73,8 +73,7 @@ describe Opal::Server do
73
73
  received_map_path = extract_map_path(last_response)
74
74
  expect(expand_path(received_map_path, js_path+'/..')).to eq(map_path)
75
75
 
76
-
77
- get maps_prefix+'/source_map/subfolder/other_file.map'
76
+ get maps_prefix+'/source_map/subfolder/other_file.self.map'
78
77
  expect(last_response).to be_ok
79
78
  map = ::SourceMap::Map.from_json(last_response.body)
80
79
  expect(map.sources).to include(maps_prefix+'/source_map/subfolder/other_file.rb')
@@ -16,4 +16,22 @@ describe Opal::TiltTemplate do
16
16
  end
17
17
  end
18
18
  end
19
+
20
+ it "support :build option" do
21
+ template = described_class.new('./spec/lib/fixtures/opal_file.rb', :build=>true)
22
+ output = template.render
23
+ expect(output).to include('"hi from opal!"')
24
+ expect(output).to include('self.$require("corelib/runtime");')
25
+ end
26
+
27
+ it "support :builder option" do
28
+ builder = Opal::Builder.new(:stubs=>['opal'])
29
+ template = described_class.new('./spec/lib/fixtures/opal_file.rb', :builder=>builder)
30
+
31
+ 2.times do
32
+ output = template.render
33
+ expect(output.scan(/hi from opal!/).length).to eql(1)
34
+ expect(output).not_to include('self.$require("corelib/runtime");')
35
+ end
36
+ end
19
37
  end
@@ -17,4 +17,4 @@ describe "Regexps with interpolation" do
17
17
  str = "a"
18
18
  /[#{str}-z]/.should == /[a-z]/
19
19
  end
20
- end
20
+ end
@@ -4,7 +4,6 @@ require 'spec_helper'
4
4
  var bridge_class_demo = function(){};
5
5
  bridge_class_demo.prototype.$foo = function() { return "bar" };
6
6
  }
7
-
8
7
  class TopBridgedClassDemo < `bridge_class_demo`
9
8
  def some_bridged_method
10
9
  [1, 2, 3]
@@ -62,3 +61,51 @@ describe "Bridged Classes" do
62
61
  end
63
62
  end
64
63
  end
64
+
65
+ class ModularizedBridgeClass
66
+ def something
67
+ 'different module'
68
+ end
69
+ end
70
+
71
+ %x{
72
+ var bridge_class_demo_module = function(){};
73
+ bridge_class_demo_module.prototype.$foo = function() { return "foobar" };
74
+ }
75
+
76
+ module BridgeModule
77
+ class ModularizedBridgeClass < `bridge_class_demo_module`
78
+ def some_bridged_method
79
+ [4, 5, 6]
80
+ end
81
+ end
82
+ end
83
+
84
+ describe 'Bridged classes in different modules' do
85
+ before do
86
+ @bridged = BridgeModule::ModularizedBridgeClass
87
+ @instance = `new bridge_class_demo_module`
88
+ end
89
+
90
+ it "should expose the given class not at the top level scope" do
91
+ @bridged.should be_kind_of(Class)
92
+ end
93
+
94
+ it 'should not disturb an existing class at the top level scope' do
95
+ ModularizedBridgeClass.new.something.should == 'different module'
96
+ end
97
+
98
+ it "gives the class the correct name" do
99
+ @bridged.name.should == "BridgeModule::ModularizedBridgeClass"
100
+ end
101
+
102
+ it "instances of class should be able to call native ruby methods" do
103
+ @instance.foo.should == "foobar"
104
+ @bridged.new.foo.should == "foobar"
105
+ end
106
+
107
+ it "allows new methods to be defined on the bridged prototype" do
108
+ @instance.some_bridged_method.should == [4, 5, 6]
109
+ @bridged.new.some_bridged_method.should == [4, 5, 6]
110
+ end
111
+ end
data/spec/rubyspecs CHANGED
@@ -55,7 +55,7 @@ corelib/core/kernel/eql_spec
55
55
  corelib/core/kernel/equal_spec
56
56
  corelib/core/kernel/equal_value_spec
57
57
  corelib/core/kernel/format_spec
58
- corelib/core/kernel/hash_spec
58
+ corelib/core/kernel/Hash_spec
59
59
  corelib/core/kernel/Integer_spec
60
60
  corelib/core/kernel/Float_spec
61
61
  corelib/core/kernel/sprintf_spec
@@ -72,6 +72,7 @@ corelib/core/module/module_function_spec
72
72
  corelib/core/module/const_get_spec
73
73
  corelib/core/module/include_spec
74
74
  corelib/core/module/instance_methods_spec
75
+ corelib/core/module/define_method_spec
75
76
 
76
77
  corelib/core/range/begin_spec
77
78
  corelib/core/range/case_compare_spec
@@ -129,6 +130,9 @@ corelib/core/regexp/escape_spec
129
130
  corelib/core/regexp/last_match_spec
130
131
  corelib/core/regexp/match_spec
131
132
  corelib/core/regexp/quote_spec
133
+ corelib/core/regexp/options_spec
134
+ corelib/core/regexp/union_spec
135
+ corelib/core/regexp/new_spec
132
136
 
133
137
  corelib/language/BEGIN_spec
134
138
  corelib/language/alias_spec
@@ -139,7 +143,7 @@ corelib/language/array_spec
139
143
  corelib/language/case_spec
140
144
  corelib/language/class_spec
141
145
  corelib/language/class_variable_spec
142
- corelib/language/constants_spec
146
+ # corelib/language/constants_spec - throw exception - NameError: uninitialized constant X::CS_SINGLETON4_CLASSES
143
147
  # corelib/language/def_spec - can't parse f('key'=>'value', *[5, 'string'])
144
148
  corelib/language/defined_spec
145
149
  # corelib/language/encoding_spec - can't parse encodings
@@ -147,7 +151,7 @@ corelib/language/ensure_spec
147
151
  # corelib/language/execution_spec - can't parse x-strings with shell commands
148
152
  corelib/language/file_spec
149
153
  corelib/language/for_spec
150
- corelib/language/hash_spec
154
+ # corelib/language/hash_spec - parse error on value "**" (tPOW) :corelib/language/hash_spec:82
151
155
  corelib/language/if_spec
152
156
  # corelib/language/line_spec - $LOADED_FEATURES not present
153
157
  # corelib/language/lambda_spec - Can't parse literal {} in parenthesized argument list
@@ -155,7 +159,7 @@ corelib/language/loop_spec
155
159
  corelib/language/magic_comment_spec
156
160
  # corelib/language/match_spec - generates invalid regexp
157
161
  corelib/language/metaclass_spec
158
- corelib/language/module_spec
162
+ # corelib/language/module_spec - infinite loop in "The module keyword sets the name of contained modules when assigning a toplevel anonymous module"
159
163
  # corelib/language/next_spec - can't parse break expr with block
160
164
  corelib/language/not_spec
161
165
  corelib/language/numbers_spec
@@ -175,89 +179,95 @@ corelib/language/singleton_class_spec
175
179
  # corelib/language/splat_spec - can't parse all splats
176
180
  # corelib/language/string_spec - can't parse strings using control-characters
177
181
  corelib/language/super_spec
178
- corelib/language/symbol_spec
182
+ # corelib/language/symbol_spec - parse error on value "}" (tRCURLY) :corelib/language/symbol_spec:89
179
183
  # corelib/language/throw_spec - unsupported
180
184
  corelib/language/undef_spec
181
185
  corelib/language/unless_spec
182
186
  corelib/language/until_spec
183
187
  # corelib/language/variables_spec - can't parse whole file
184
- corelib/language/while_spec
188
+ # corelib/language/while_spec - infinite loops in:
189
+ # it "stops running body if interrupted by break in a begin ... end element op-assign-or value" do
190
+ # it "stops running body if interrupted by break in a parenthesized attribute op-assign-or value" do
191
+ # it "stops running body if interrupted by break in a begin ... end attribute op-assign-or value" do
192
+ # it "stops running body if interrupted by break in a parenthesized attribute op-assign-or value" do
193
+ # it "stops running body if interrupted by break in a begin ... end attribute op-assign-or value" do
194
+
185
195
  # corelib/language/yield_spec - can't parse destructuring argument list, see block_spec
186
196
 
187
- stdlib/rubysl-singleton/spec
188
- stdlib/rubysl-observer/spec
189
- stdlib/rubysl-pathname/spec
197
+ corelib/library/singleton
198
+ corelib/library/observer
199
+ corelib/library/pathname
190
200
 
191
- stdlib/rubysl-strscan/spec/beginning_of_line_spec
192
- stdlib/rubysl-strscan/spec/bol_spec
193
- stdlib/rubysl-strscan/spec/check_spec
194
- stdlib/rubysl-strscan/spec/element_reference_spec
195
- stdlib/rubysl-strscan/spec/eos_spec
196
- stdlib/rubysl-strscan/spec/get_byte_spec
197
- stdlib/rubysl-strscan/spec/peek_spec
198
- stdlib/rubysl-strscan/spec/pos_spec
199
- stdlib/rubysl-strscan/spec/reset_spec
200
- stdlib/rubysl-strscan/spec/rest_spec
201
- stdlib/rubysl-strscan/spec/scan_spec
202
- stdlib/rubysl-strscan/spec/skip_spec
203
- stdlib/rubysl-strscan/spec/terminate_spec
201
+ corelib/library/stringscanner/beginning_of_line_spec
202
+ corelib/library/stringscanner/bol_spec
203
+ corelib/library/stringscanner/check_spec
204
+ corelib/library/stringscanner/element_reference_spec
205
+ corelib/library/stringscanner/eos_spec
206
+ corelib/library/stringscanner/get_byte_spec
207
+ corelib/library/stringscanner/peek_spec
208
+ corelib/library/stringscanner/pos_spec
209
+ corelib/library/stringscanner/reset_spec
210
+ corelib/library/stringscanner/rest_spec
211
+ corelib/library/stringscanner/scan_spec
212
+ corelib/library/stringscanner/skip_spec
213
+ corelib/library/stringscanner/terminate_spec
204
214
 
205
- stdlib/rubysl-delegate/spec/delegator/send_spec
215
+ corelib/library/delegate/delegator/send_spec
206
216
 
207
- stdlib/rubysl-erb/spec/util/h_spec
208
- stdlib/rubysl-erb/spec/util/html_escape_spec
217
+ corelib/library/erb/util/h_spec
218
+ corelib/library/erb/util/html_escape_spec
209
219
 
210
- stdlib/rubysl-set/spec/add_spec
211
- stdlib/rubysl-set/spec/append_spec
212
- stdlib/rubysl-set/spec/classify_spec
213
- stdlib/rubysl-set/spec/clear_spec
214
- stdlib/rubysl-set/spec/collect_spec
215
- stdlib/rubysl-set/spec/constructor_spec
216
- stdlib/rubysl-set/spec/delete_if_spec
217
- stdlib/rubysl-set/spec/delete_spec
218
- stdlib/rubysl-set/spec/difference_spec
219
- stdlib/rubysl-set/spec/each_spec
220
- stdlib/rubysl-set/spec/empty_spec
221
- stdlib/rubysl-set/spec/enumerable/to_set_spec
222
- stdlib/rubysl-set/spec/eql_spec
223
- stdlib/rubysl-set/spec/equal_value_spec
224
- stdlib/rubysl-set/spec/include_spec
225
- stdlib/rubysl-set/spec/initialize_spec
226
- stdlib/rubysl-set/spec/length_spec
227
- stdlib/rubysl-set/spec/map_spec
228
- stdlib/rubysl-set/spec/member_spec
229
- stdlib/rubysl-set/spec/merge_spec
230
- stdlib/rubysl-set/spec/minus_spec
231
- stdlib/rubysl-set/spec/replace_spec
232
- stdlib/rubysl-set/spec/size_spec
233
- stdlib/rubysl-set/spec/subtract_spec
234
- stdlib/rubysl-set/spec/to_a_spec
235
- # stdlib/rubysl-set/spec/divide_spec
236
- # stdlib/rubysl-set/spec/exclusion_spec
237
- # stdlib/rubysl-set/spec/flatten_merge_spec
238
- # stdlib/rubysl-set/spec/flatten_spec
239
- # stdlib/rubysl-set/spec/hash_spec
240
- # stdlib/rubysl-set/spec/initialize_copy_spec
241
- # stdlib/rubysl-set/spec/inspect_spec
242
- # stdlib/rubysl-set/spec/intersection_spec
243
- # stdlib/rubysl-set/spec/keep_if_spec
244
- # stdlib/rubysl-set/spec/plus_spec
245
- # stdlib/rubysl-set/spec/pretty_print_cycle_spec
246
- # stdlib/rubysl-set/spec/pretty_print_spec
247
- # stdlib/rubysl-set/spec/proper_subset_spec
248
- # stdlib/rubysl-set/spec/proper_superset_spec
249
- # stdlib/rubysl-set/spec/reject_spec
250
- # stdlib/rubysl-set/spec/select_spec
251
- # stdlib/rubysl-set/spec/subset_spec
252
- # stdlib/rubysl-set/spec/superset_spec
253
- # stdlib/rubysl-set/spec/union_spec
220
+ corelib/library/set/add_spec
221
+ corelib/library/set/append_spec
222
+ corelib/library/set/classify_spec
223
+ corelib/library/set/clear_spec
224
+ corelib/library/set/collect_spec
225
+ corelib/library/set/constructor_spec
226
+ corelib/library/set/delete_if_spec
227
+ corelib/library/set/delete_spec
228
+ corelib/library/set/difference_spec
229
+ corelib/library/set/each_spec
230
+ corelib/library/set/empty_spec
231
+ corelib/library/set/enumerable/to_set_spec
232
+ corelib/library/set/eql_spec
233
+ corelib/library/set/equal_value_spec
234
+ corelib/library/set/include_spec
235
+ corelib/library/set/initialize_spec
236
+ corelib/library/set/length_spec
237
+ corelib/library/set/map_spec
238
+ corelib/library/set/member_spec
239
+ corelib/library/set/merge_spec
240
+ corelib/library/set/minus_spec
241
+ corelib/library/set/replace_spec
242
+ corelib/library/set/size_spec
243
+ corelib/library/set/subtract_spec
244
+ corelib/library/set/to_a_spec
245
+ corelib/library/set/plus_spec
246
+ corelib/library/set/union_spec
247
+ # corelib/library/set/divide_spec
248
+ # corelib/library/set/exclusion_spec
249
+ # corelib/library/set/flatten_merge_spec
250
+ # corelib/library/set/flatten_spec
251
+ # corelib/library/set/hash_spec
252
+ # corelib/library/set/initialize_copy_spec
253
+ # corelib/library/set/inspect_spec
254
+ # corelib/library/set/intersection_spec
255
+ # corelib/library/set/keep_if_spec
256
+ # corelib/library/set/pretty_print_cycle_spec
257
+ # corelib/library/set/pretty_print_spec
258
+ # corelib/library/set/proper_subset_spec
259
+ # corelib/library/set/proper_superset_spec
260
+ # corelib/library/set/reject_spec
261
+ # corelib/library/set/select_spec
262
+ # corelib/library/set/subset_spec
263
+ # corelib/library/set/superset_spec
254
264
 
255
- stdlib/rubysl-date/spec/date/add_month_spec
256
- stdlib/rubysl-date/spec/date/add_spec
257
- stdlib/rubysl-date/spec/date/append_spec
258
- stdlib/rubysl-date/spec/date/case_compare_spec
259
- stdlib/rubysl-date/spec/date/eql_spec
260
- stdlib/rubysl-date/spec/date/minus_month_spec
261
- stdlib/rubysl-date/spec/date/minus_spec
262
- stdlib/rubysl-date/spec/date/plus_spec
263
- stdlib/rubysl-date/spec/date/strftime_spec
265
+ corelib/library/date/add_month_spec
266
+ corelib/library/date/add_spec
267
+ corelib/library/date/append_spec
268
+ corelib/library/date/case_compare_spec
269
+ corelib/library/date/eql_spec
270
+ corelib/library/date/minus_month_spec
271
+ corelib/library/date/minus_spec
272
+ corelib/library/date/plus_spec
273
+ corelib/library/date/strftime_spec
data/stdlib/encoding.rb CHANGED
@@ -67,6 +67,9 @@ class Encoding
67
67
  def bytesize(*)
68
68
  raise NotImplementedError
69
69
  end
70
+
71
+ class EncodingError < StandardError; end
72
+ class CompatibilityError < EncodingError; end
70
73
  end
71
74
 
72
75
  Encoding.register "UTF-8", aliases: ["CP65001"], ascii: true do
data/stdlib/native.rb CHANGED
@@ -492,7 +492,7 @@ class Hash
492
492
  keys = self.keys,
493
493
  _map = self.map,
494
494
  smap = self.smap,
495
- map, khash, value;
495
+ map, khash, value, key;
496
496
 
497
497
  for (var i = 0, length = keys.length; i < length; i++) {
498
498
  key = keys[i];
data/stdlib/pp.rb CHANGED
@@ -3,12 +3,33 @@ module Kernel
3
3
  inspect
4
4
  end
5
5
 
6
- if `(typeof(console) === "undefined" || typeof(console.log) === "undefined")`
7
- alias pp p
8
- else
9
- def pp(*args)
10
- args.each { |obj| `console.log(obj)` }
11
- args.length <= 1 ? args[0] : args
6
+ def pp(*objs)
7
+ objs.each {|obj|
8
+ PP.pp(obj)
9
+ }
10
+ objs.size <= 1 ? objs.first : objs
11
+ end
12
+ module_function :pp
13
+ end
14
+
15
+ class PP
16
+ class << self
17
+ if `(typeof(console) === "undefined" || typeof(console.log) === "undefined")`
18
+ def pp(obj, out=$stdout, width=79)
19
+ p(*args)
20
+ end
21
+ else
22
+ def pp(obj, out=`console`, width=79)
23
+ if `#{out} === console`
24
+ `console.log(obj)`
25
+ elsif String === out
26
+ out + obj.inspect + "\n"
27
+ else
28
+ out << obj.inspect + "\n"
29
+ end
30
+ end
12
31
  end
32
+
33
+ alias :singleline_pp :pp
13
34
  end
14
35
  end