File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,19 @@ QUnit.test("difference", function() {
183
183
) ;
184
184
QUnit . deepEqual ( res , gt3 , "secondary and primary" ) ;
185
185
186
+ res = set . difference (
187
+ new MaybeDateStringSet ( {
188
+ range : new is . In ( [ 3 ] ) ,
189
+ enum : set . EMPTY
190
+ } ) ,
191
+ new MaybeDateStringSet ( {
192
+ range : new is . In ( [ 3 ] ) ,
193
+ enum : set . EMPTY
194
+ } )
195
+ ) ;
196
+
197
+ QUnit . equal ( res , set . EMPTY , "equal is empty" ) ;
198
+
186
199
} ) ;
187
200
188
201
QUnit . test ( "difference with ComparisonSet" , function ( ) {
@@ -304,7 +317,23 @@ QUnit.test("union", function() {
304
317
} ) ;
305
318
306
319
320
+ QUnit . test ( "isSubset" , function ( ) {
321
+ var res ;
307
322
323
+ res = set . isSubset (
324
+ new MaybeDateStringSet ( {
325
+ range : new is . In ( [ 3 ] ) ,
326
+ enum : set . EMPTY
327
+ } ) ,
328
+ new MaybeDateStringSet ( {
329
+ range : new is . In ( [ 3 ] ) ,
330
+ enum : set . EMPTY
331
+ } )
332
+ ) ;
333
+
334
+ QUnit . ok ( res , "is a subset" ) ;
335
+
336
+ } ) ;
308
337
309
338
QUnit . test ( "can make maybe type from normal type and makeMaybeSetType" , function ( ) {
310
339
var MaybeNumber = canReflect . assignSymbols ( { } , {
Original file line number Diff line number Diff line change @@ -95,6 +95,9 @@ function makeMaybe(inValues, makeChildType) {
95
95
} else {
96
96
this . enum = result . enum ;
97
97
}
98
+ if ( this . enum === set . EMPTY && this . range === set . EMPTY ) {
99
+ return set . EMPTY ;
100
+ }
98
101
}
99
102
Maybe . prototype . orValues = function ( ) {
100
103
var values = [ ] ;
@@ -112,6 +115,8 @@ function makeMaybe(inValues, makeChildType) {
112
115
return rangeIsMember . apply ( this . range , arguments ) || enumIsMember . apply ( this . enum , arguments ) ;
113
116
}
114
117
118
+
119
+
115
120
set . defineComparison ( Maybe , Maybe , {
116
121
union : function ( maybeA , maybeB ) {
117
122
var enumSet = set . union ( maybeA . enum , maybeB . enum ) ;
You can’t perform that action at this time.
0 commit comments