/
declare.t
546 lines (438 loc) · 8.97 KB
/
declare.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
use v6;
use Test;
# see if you can declare the various built-in types
# a broad but not in depth test of the existence of various types
plan 79;
# L<S02/"Built-in Type Conventions"/"Built-in object types start with an uppercase letter">
# immutable types (e.g. Int, Num, Complex, Rat, Str, Bit, Regex, Set, Block, List)
{
my Int $namcu =2;
isa_ok($namcu,Int);
}
{
my Num $namcu =1.1e1;
isa_ok($namcu,Num);
}
# Type mismatch in assignment; expected something matching type Complex but got something of type Num()
#?rakudo skip 'Complex not type converted properly during assignment from Num'
#?niecza skip 'Complex not type converted properly during assignment from Rat'
{
my Complex $namcu =1.3;
isa_ok($namcu,Complex);
}
{
my Rat $namcu = 7 / 4;
isa_ok($namcu,Rat);
}
{
my Str $lerpoi = "broda";
isa_ok($lerpoi,Str);
}
#?rakudo skip 'Bit not implemented'
#?niecza skip 'Bit not implemented'
{
my Bit $namcu =1;
isa_ok($namcu,Bit);
}
{
my Regex $morna;
isa_ok($morna, Regex);
}
#?niecza skip "Set NYI"
{
my Set $selcmima;
isa_ok($selcmima, Set);
}
{
my Block $broda;
isa_ok($broda, Block);
}
{
my List $liste;
isa_ok($liste, List);
}
# mutable (container) types, such as Scalar, Array, Hash, Buf, Routine, Module
# Buf nacpoi
{
my Scalar $brode;
isa_ok($brode, Scalar);
}
{
my Array $porsi;
isa_ok($porsi, Array);
}
{
my Hash $brodi;
isa_ok($brodi, Hash);
}
#?niecza skip "Buf NYI"
{
my Buf $nacpoi;
isa_ok($nacpoi, Buf);
}
{
my Routine $gunka;
isa_ok($gunka, Routine);
}
#?rakudo skip 'No Module type yet'
#?niecza skip 'No Module type yet'
{
my Module $brodu;
isa_ok($brodu, Module);
}
# non-instantiable Roles such as Callable, Failure, and Integral
{
my Callable $fancu ;
ok($fancu ~~ Callable);
}
#?rakudo skip 'Integral not implemented'
{
my Integral $foo;
ok($foo ~~ Integral);
}
# Non-object (native) types are lowercase: int, num, complex, rat, buf, bit.
#?rakudo skip 'int not implemented'
#?niecza skip 'int not implemented'
{
my int $namcu =2;
isa_ok($namcu,int);
}
#?rakudo skip 'num not implemented'
#?niecza skip 'num not implemented'
{
my num $namcu =1.1;
isa_ok($namcu,num);
}
# Type mismatch in assignment; expected something matching type Complex but got something of type Num()
#?rakudo skip 'complex not implemented'
#?niecza skip 'complex not implemented'
{
my complex $namcu =1.3;
isa_ok($namcu,complex);
}
#?rakudo skip 'rat not implemented'
#?niecza skip 'rat not implemented'
{
my rat $namcu = 7 / 4;
isa_ok($namcu,rat);
}
#?rakudo skip 'bit not implemented'
#?niecza skip 'bit not implemented'
{
my bit $namcu =1;
isa_ok($namcu,bit);
}
#?rakudo skip 'buf not implemented'
#?niecza skip 'buf not implemented'
{
my buf $nacpoi;
isa_ok($nacpoi, buf);
}
# junction StrPos StrLen uint Nil Whatever Mu Failure
# Exception Range Bag Signature Capture Blob Instant Duration
# Keyhash KeySet KeyBag Pair Mapping IO Routine Sub Method
# Submethod Macro Match Package Module Class Role Grammar Any
#?rakudo skip 'junction not implemented'
#?niecza skip 'junction not implemented'
{
my junction $sor;
isa_ok($sor, junction);
}
#?rakudo skip 'StrPos not implemented'
#?niecza skip 'StrPos not implemented'
{
my StrPos $pa;
isa_ok($pa,StrPos );
}
#?rakudo skip 'StrLen not implemented'
#?niecza skip 'StrLen not implemented'
{
my StrLen $re;
isa_ok($re,StrLen );
}
{
my Nil $ci;
ok($ci ~~ Nil);
}
{
my Whatever $vo;
isa_ok($vo,Whatever );
}
{
my Mu $mu;
ok($mu ~~ Mu );
}
#?niecza skip 'Failure not implemented'
{
my Failure $xa;
isa_ok($xa,Failure );
}
#?niecza skip 'Exception not implemented'
{
my Exception $ze;
isa_ok($ze,Exception );
}
{
my Range $bi;
isa_ok($bi,Range );
}
#?niecza skip 'Bag not implemented'
{
my Bag $so;
isa_ok($so,Bag );
}
#?niecza skip 'Signature not implemented'
{
my Signature $pano;
isa_ok($pano,Signature );
}
{
my Capture $papa;
isa_ok($papa,Capture );
}
#?rakudo skip 'Blob not implemented'
#?niecza skip 'Blob not implemented'
{
my Blob $pare;
isa_ok($pare,Blob );
}
{
my Instant $paci;
isa_ok($paci,Instant );
}
#?niecza skip 'Duration not implemented'
{
my Duration $pavo;
isa_ok($pavo,Duration );
}
#?niecza skip 'KeyHash not implemented'
{
my KeyHash $pamu;
isa_ok($pamu,KeyHash );
}
#?rakudo skip 'KeySet not implemented'
#?niecza skip 'KeySet not implemented'
{
my KeySet $paxa;
isa_ok($paxa,KeySet );
}
#?rakudo skip 'KeyBag not implemented'
#?niecza skip 'KeyBag not implemented'
{
my KeyBag $paze;
isa_ok($paze,KeyBag );
}
{
my Pair $pabi;
isa_ok($pabi,Pair );
}
{
my EnumMap $paso;
isa_ok($paso,EnumMap );
}
{
my IO $reno;
isa_ok($reno,IO );
}
{
my Routine $repa;
isa_ok($repa,Routine );
}
{
my Sub $rere;
isa_ok($rere, Sub );
}
{
my sub bar() { say 'blah' };
my Sub $rr = &bar;
isa_ok($rr, Sub );
}
{
my sub baz() { return 1;};
my sub bar() { return baz;} ;
my &foo := &bar;
is(&foo(), 1,'nested sub call');
}
{
my sub baz() { return 1;};
my sub bar() { return baz;} ;
my $foo = &bar;
is($($foo()), 1, 'nested sub call');
}
{
my Method $reci;
isa_ok($reci, Method );
}
{
my Submethod $revo;
isa_ok($revo, Submethod );
}
#?rakudo skip 'Macro not implemented'
#?niecza skip 'Macro not implemented'
{
my Macro $remu;
isa_ok($remu,Macro );
}
{
my Match $rexa;
isa_ok($rexa,Match );
}
{
my Grammar $cire;
isa_ok($cire,Grammar );
}
{
my Any $civo;
isa_ok($civo, Any );
}
# http://svn.pugscode.org/pugs/src/perl6/CORE.pad had list of types pugs supports
{
my Bool $jetfu;
isa_ok($jetfu, Bool);
}
#?rakudo skip 'Order NYI'
#?niecza skip 'Order not implemented'
{
my Order $karbi;
isa_ok($karbi, Order);
}
#?rakudo skip 'Matcher isa not implemented'
#?niecza skip 'Matcher not implemented'
{
my Matcher $mapti;
isa_ok($mapti, Matcher);
}
#?niecza skip 'Proxy not implemented'
{
my Proxy $krati;
isa_ok($krati, Proxy);
}
# CharLingua Byte Char AnyChar
#?rakudo skip 'Char not implemented'
#?niecza skip 'Char not implemented'
{
my Char $pav;
isa_ok($pav, Char);
}
#?rakudo skip 'Byte not implemented'
#?niecza skip 'Byte not implemented'
{
my Byte $biv;
isa_ok($biv, Byte);
}
#?rakudo skip 'AnyChar not implemented'
#?niecza skip 'AnyChar not implemented'
{
my AnyChar $lerfu;
isa_ok($lerfu, AnyChar);
}
#?rakudo skip 'CharLingua not implemented'
#?niecza skip 'CharLingua not implemented'
{
my CharLingua $lerfu;
isa_ok($lerfu, CharLingua );
}
#?rakudo skip 'Codepoint not implemented'
#?niecza skip 'Codepoint not implemented'
{
my Codepoint $cypy;
isa_ok($cypy,Codepoint );
}
#?rakudo skip 'Grapheme not implemented'
#?niecza skip 'Grapheme not implemented'
{
my Grapheme $gy;
isa_ok($gy,Grapheme );
}
# Positional Associative Ordering Ordered
# KeyExtractor Comparator OrderingPair HyperWhatever
#?niecza skip 'Positional not implemented'
{
my Positional $mokca;
ok($mokca ~~ Positional,'Positional exists');
}
#?niecza skip 'Associative not implemented'
{
my Associative $kansa;
ok($kansa ~~ Associative,'Associative exists');
}
#?rakudo skip 'Ordering not implemented'
#?niecza skip 'Ordering not implemented'
{
my Ordering $foo;
isa_ok($foo,Ordering);
}
#?rakudo skip 'KeyExtractor not implemented'
#?niecza skip 'KeyExtractor not implemented'
{
my KeyExtractor $ckiku;
isa_ok($ckiku, KeyExtractor);
}
# KeyExtractor Comparator OrderingPair HyperWhatever
#?rakudo skip 'Comparator not implemented'
#?niecza skip 'Comparator not implemented'
{
my Comparator $bar;
isa_ok($bar,Comparator);
}
#?rakudo skip 'OrderingPair not implemented'
#?niecza skip 'OrderingPair not implemented'
{
my OrderingPair $foop;
isa_ok($foop,OrderingPair);
}
#?rakudo skip 'HyperWhatever not implemented'
#?niecza skip 'HyperWhatever not implemented'
{
my HyperWhatever $baz;
isa_ok($baz,HyperWhatever);
}
# utf8 utf16 utf32
#?rakudo skip 'utf8 not implemented'
#?niecza skip 'utf8 not implemented'
{
my utf8 $ubi;
isa_ok($ubi,utf8);
}
#?rakudo skip 'utf16 not implemented'
#?niecza skip 'utf16 not implemented'
{
my utf16 $upaxa;
isa_ok($upaxa,utf16);
}
#?rakudo skip 'utf32 not implemented'
#?niecza skip 'utf32 not implemented'
{
my utf32 $ucire;
isa_ok($ucire,utf32);
}
# L<S09/Sized types/>
# int in1 int2 int4 int8 int16 in32 int64
# uint uin1 uint2 uint4 uint8 uint16 uint32 uint64
# t/spec/S02-builtin_data_types/int-uint.t already has these covered
# L<S09/Sized types/"num16">
# num16 num32 num64 num128
# complex16 complex32 complex64 complex128
# buf8 buf16 buf32 buf64
#?rakudo skip 'num16 not implemented'
#?niecza skip 'num16 not implemented'
{
my num16 $namcupaxa;
isa_ok($namcupaxa,num16);
}
# TODO FIXME rakudo does not have any of them anyway
# L<S02/"Hierarchical types"/"A non-scalar type may be qualified">
# my Egg $cup; my Egg @carton; my Array of Egg @box; my Array of Array of Egg @crate;
# my Hash of Array of Recipe %book;
# my Hash:of(Array:of(Recipe)) %book;
# my Hash of Array of Recipe %book; my %book of Hash of Array of Recipe
{
my Array of Int @box;
ok(1,'Array of Int @box');
}
{
my Array of Array of Int @box;
ok(1,'Array of Array of Int @box');
}
# TODO FIXME
# vim: ft=perl6