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.
- checksums.yaml +4 -4
- data/.gitmodules +0 -24
- data/.jshintrc +51 -0
- data/.travis.yml +6 -1
- data/CHANGELOG.md +2 -0
- data/Gemfile +3 -7
- data/README.md +2 -3
- data/Rakefile +1 -0
- data/lib/mspec/opal/rake_task.rb +1 -1
- data/lib/opal/builder.rb +21 -3
- data/lib/opal/builder_processors.rb +2 -2
- data/lib/opal/cli.rb +8 -5
- data/lib/opal/erb.rb +1 -1
- data/lib/opal/nodes/call.rb +1 -1
- data/lib/opal/nodes/call_special.rb +1 -1
- data/lib/opal/nodes/helpers.rb +6 -4
- data/lib/opal/nodes/iter.rb +2 -2
- data/lib/opal/nodes/singleton_class.rb +2 -1
- data/lib/opal/parser/lexer.rb +3 -2
- data/lib/opal/path_reader.rb +8 -1
- data/lib/opal/paths.rb +23 -16
- data/lib/opal/regexp_anchors.rb +5 -0
- data/lib/opal/sprockets/erb.rb +1 -1
- data/lib/opal/sprockets/processor.rb +21 -35
- data/lib/opal/sprockets/source_map_server.rb +5 -5
- data/lib/opal/version.rb +3 -1
- data/lib/tilt/opal.rb +11 -5
- data/opal.gemspec +2 -2
- data/opal/corelib/array.rb +196 -4
- data/opal/corelib/enumerable.rb +1 -1
- data/opal/corelib/enumerator.rb +2 -2
- data/opal/corelib/hash.rb +6 -6
- data/opal/corelib/kernel.rb +5 -3
- data/opal/corelib/module.rb +18 -12
- data/opal/corelib/regexp.rb +110 -4
- data/opal/corelib/runtime.js +12 -4
- data/opal/corelib/string.rb +51 -95
- data/opal/corelib/string/inheritance.rb +22 -0
- data/opal/corelib/variables.rb +1 -1
- data/spec/filters/bugs/array.rb +3 -39
- data/spec/filters/bugs/basic_object.rb +20 -0
- data/spec/filters/bugs/date.rb +5 -0
- data/spec/filters/bugs/enumerable.rb +9 -0
- data/spec/filters/bugs/enumerator.rb +0 -7
- data/spec/filters/bugs/hash.rb +2 -0
- data/spec/filters/bugs/kernel.rb +5 -0
- data/spec/filters/bugs/language.rb +14 -0
- data/spec/filters/bugs/method.rb +5 -0
- data/spec/filters/bugs/module.rb +23 -0
- data/spec/filters/bugs/regular_expressions.rb +41 -0
- data/spec/filters/bugs/singleton.rb +3 -0
- data/spec/filters/bugs/string.rb +2 -9
- data/spec/filters/bugs/stringscanner.rb +3 -0
- data/spec/filters/bugs/time.rb +19 -0
- data/spec/filters/unsupported/module.rb +6 -0
- data/spec/filters/unsupported/mutable_strings.rb +8 -0
- data/spec/filters/unsupported/regular_expressions.rb +90 -0
- data/spec/lib/builder_spec.rb +12 -6
- data/spec/lib/cli_spec.rb +2 -2
- data/spec/lib/path_reader_spec.rb +12 -0
- data/spec/lib/sprockets/server_spec.rb +7 -8
- data/spec/lib/tilt/opal_spec.rb +18 -0
- data/spec/opal/core/language/regexp_spec.rb +1 -1
- data/spec/opal/core/runtime/bridged_classes_spec.rb +48 -1
- data/spec/rubyspecs +88 -78
- data/stdlib/encoding.rb +3 -0
- data/stdlib/native.rb +1 -1
- data/stdlib/pp.rb +27 -6
- data/stdlib/set.rb +10 -0
- data/tasks/linting.rake +18 -0
- data/tasks/testing.rake +11 -4
- data/{stdlib → vendored-minitest}/minitest.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/assertions.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/autorun.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/benchmark.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/expectations.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/hell.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/mock.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/parallel.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/pride.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/pride_plugin.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/spec.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/test.rb +0 -0
- data/{stdlib → vendored-minitest}/minitest/unit.rb +0 -0
- data/vendored-minitest/test/unit.rb +23 -0
- metadata +31 -29
- data/stdlib/test/unit.rb +0 -10
- data/tasks/documentation.rake +0 -38
data/spec/lib/builder_spec.rb
CHANGED
@@ -11,12 +11,8 @@ describe Opal::Builder do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'respect #require_tree calls' do
|
14
|
-
|
15
|
-
|
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.
|
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(
|
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')
|
data/spec/lib/tilt/opal_spec.rb
CHANGED
@@ -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
|
@@ -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/
|
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
|
-
|
188
|
-
|
189
|
-
|
197
|
+
corelib/library/singleton
|
198
|
+
corelib/library/observer
|
199
|
+
corelib/library/pathname
|
190
200
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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
|
-
|
215
|
+
corelib/library/delegate/delegator/send_spec
|
206
216
|
|
207
|
-
|
208
|
-
|
217
|
+
corelib/library/erb/util/h_spec
|
218
|
+
corelib/library/erb/util/html_escape_spec
|
209
219
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
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
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
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
data/stdlib/native.rb
CHANGED
data/stdlib/pp.rb
CHANGED
@@ -3,12 +3,33 @@ module Kernel
|
|
3
3
|
inspect
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|