File tree 6 files changed +411
-94
lines changed
6 files changed +411
-94
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,10 @@ task :mspec_node do
41
41
42
42
if pattern
43
43
custom = Dir [ pattern ]
44
+ p custom . size
45
+ p rubyspecs . grep /hash/
44
46
custom &= rubyspecs if whitelist_pattern
47
+ p whitelist_pattern , custom . size
45
48
specs = add_specs . ( :custom , custom )
46
49
else
47
50
specs = add_specs . ( :shared , shared )
Original file line number Diff line number Diff line change
1
+ # 'asdf' =~ /(a)./
2
+ #
3
+ # p $'
4
+ # p $1
5
+ # p $2
6
+ # `console.log(2, $opal.gvars['1'])`
7
+ # b = $1
8
+ # `console.log(1, b)`
9
+ # nil
10
+
11
+ puts [ *1 ..3 ] . to_s
12
+ puts [ *( 1 ..3 ) ] . to_s
13
+ puts [ *Object . new ] . to_s
Original file line number Diff line number Diff line change @@ -159,6 +159,10 @@ def log(str)
159
159
160
160
def after ( state )
161
161
super
162
+ print_example ( state )
163
+ end
164
+
165
+ def print_example ( state )
162
166
unless exception?
163
167
green ( '.' )
164
168
else
@@ -176,13 +180,19 @@ def finish
176
180
end
177
181
end
178
182
179
- class PhantomDebugFormatter < PhantomFormatter
183
+ class PhantomDocFormatter < PhantomFormatter
180
184
def after ( state = nil )
181
185
( @exception && state ) ? red ( state . description ) : green ( state . description )
182
186
super
183
187
end
184
188
end
185
189
190
+ class NodeJSDocFormatter < NodeJSFormatter
191
+ def print_example ( state )
192
+ ( @exception && state ) ? red ( state . description +"\n " ) : green ( state . description +"\n " )
193
+ end
194
+ end
195
+
186
196
module MSpec
187
197
def self . opal_runner
188
198
@env = Object . new
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 959
959
960
960
var hash = new Opal . Hash . $$alloc ( ) ,
961
961
keys = [ ] ,
962
- map = { } ,
962
+ _map = { } ,
963
+ smap = { } ,
963
964
key , obj , length , khash ;
964
965
965
- hash . map = map ;
966
+ hash . map = _map ;
967
+ hash . smap = smap ;
966
968
hash . keys = keys ;
967
969
968
970
if ( arguments . length == 1 ) {
978
980
979
981
key = pair [ 0 ] ;
980
982
obj = pair [ 1 ] ;
981
- khash = key . $hash ( ) ;
983
+
984
+ if ( key . $$is_string ) {
985
+ khash = key ;
986
+ map = smap ;
987
+ } else {
988
+ khash = key . $hash ( ) ;
989
+ map = _map ;
990
+ }
982
991
983
992
if ( map [ khash ] == null ) {
984
993
keys . push ( key ) ;
1005
1014
for ( var j = 0 ; j < length ; j ++ ) {
1006
1015
key = arguments [ j ] ;
1007
1016
obj = arguments [ ++ j ] ;
1008
- khash = key . $hash ( ) ;
1017
+
1018
+ if ( key . $$is_string ) {
1019
+ khash = key ;
1020
+ map = smap ;
1021
+ } else {
1022
+ khash = key . $hash ( ) ;
1023
+ map = _map ;
1024
+ }
1009
1025
1010
1026
if ( map [ khash ] == null ) {
1011
1027
keys . push ( key ) ;
1028
1044
var hash = new Opal . Hash . $$alloc ( ) ;
1029
1045
1030
1046
hash . keys = keys ;
1031
- hash . map = map ;
1047
+ hash . map = { } ;
1048
+ hash . smap = map ;
1032
1049
1033
1050
return hash ;
1034
1051
} ;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ def at_exit(&block)
28
28
29
29
case
30
30
when defined? ( NodeJS )
31
- formatter_class = NodeJSFormatter
31
+ formatter_class = NodeJSDocFormatter
32
32
when `(typeof(window) !== 'undefined')`
33
33
if `!!window.OPAL_SPEC_PHANTOM`
34
34
require 'phantomjs'
You can’t perform that action at this time.
0 commit comments