Repository navigation
Expand file tree
/
Copy pathstring_ext.feature
More file actions
1366 lines (903 loc) · 44.3 KB
/
Copy pathstring_ext.feature
File metadata and controls
1366 lines (903 loc) · 44.3 KB
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
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@conformance
Feature: string_ext
Tests for the strings extension library.
# char_at --
@wip
Scenario: char_at/middle_index
When CEL expression "'tacocat'.charAt(3)" is evaluated
Then value is celpy.celtypes.StringType(source='o')
@wip
Scenario: char_at/end_index
When CEL expression "'tacocat'.charAt(7)" is evaluated
Then value is celpy.celtypes.StringType(source='')
@wip
Scenario: char_at/multiple
When CEL expression "'©αT'.charAt(0) == '©' && '©αT'.charAt(1) == 'α' && '©αT'.charAt(2) == 'T'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# index_of --
@wip
Scenario: index_of/empty_index
When CEL expression "'tacocat'.indexOf('')" is evaluated
Then value is celpy.celtypes.IntType(source=0)
@wip
Scenario: index_of/string_index
When CEL expression "'tacocat'.indexOf('ac')" is evaluated
Then value is celpy.celtypes.IntType(source=1)
@wip
Scenario: index_of/nomatch
When CEL expression "'tacocat'.indexOf('none') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/empty_index
When CEL expression "'tacocat'.indexOf('', 3) == 3" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/char_index
When CEL expression "'tacocat'.indexOf('a', 3) == 5" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/string_index
When CEL expression "'tacocat'.indexOf('at', 3) == 5" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/unicode_char
When CEL expression "'ta©o©αT'.indexOf('©') == 2" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/unicode_char_index
When CEL expression "'ta©o©αT'.indexOf('©', 3) == 4" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/unicode_string_index
When CEL expression "'ta©o©αT'.indexOf('©αT', 3) == 4" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/unicode_string_nomatch_index
When CEL expression "'ta©o©αT'.indexOf('©α', 5) == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/char_index
When CEL expression "'ijk'.indexOf('k') == 2" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/string_with_space_fullmatch
When CEL expression "'hello wello'.indexOf('hello wello') == 0" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/string_with_space_index
When CEL expression "'hello wello'.indexOf('ello', 6) == 7" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: index_of/string_nomatch_index
When CEL expression "'hello wello'.indexOf('elbo room!!') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# last_index_of --
@wip
Scenario: last_index_of/empty_string
When CEL expression "''.lastIndexOf('@@') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/empty_argument
When CEL expression "'tacocat'.lastIndexOf('') == 7" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string
When CEL expression "'tacocat'.lastIndexOf('at') == 5" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string_nomatch
When CEL expression "'tacocat'.lastIndexOf('none') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/empty_index
When CEL expression "'tacocat'.lastIndexOf('', 3) == 3" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/char_index
When CEL expression "'tacocat'.lastIndexOf('a', 3) == 1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/unicode_char
When CEL expression "'ta©o©αT'.lastIndexOf('©') == 4" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/unicode_char_index
When CEL expression "'ta©o©αT'.lastIndexOf('©', 3) == 2" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/unicode_string_index
When CEL expression "'ta©o©αT'.lastIndexOf('©α', 4) == 4" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string_with_space_string_index
When CEL expression "'hello wello'.lastIndexOf('ello', 6) == 1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string_with_space_string_nomatch
When CEL expression "'hello wello'.lastIndexOf('low') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string_with_space_string_with_space_nomatch
When CEL expression "'hello wello'.lastIndexOf('elbo room!!') == -1" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/string_with_space_fullmatch
When CEL expression "'hello wello'.lastIndexOf('hello wello') == 0" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: last_index_of/repeated_string
When CEL expression "'bananananana'.lastIndexOf('nana', 7) == 6" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# ascii_casing --
@wip
Scenario: ascii_casing/lowerascii
When CEL expression "'TacoCat'.lowerAscii() == 'tacocat'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: ascii_casing/lowerascii_unicode
When CEL expression "'TacoCÆt'.lowerAscii() == 'tacocÆt'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: ascii_casing/lowerascii_unicode_with_space
When CEL expression "'TacoCÆt Xii'.lowerAscii() == 'tacocÆt xii'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: ascii_casing/upperascii
When CEL expression "'tacoCat'.upperAscii() == 'TACOCAT'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: ascii_casing/upperascii_unicode
When CEL expression "'tacoCαt'.upperAscii() == 'TACOCαT'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: ascii_casing/upperascii_unicode_with_space
When CEL expression "'TacoCÆt Xii'.upperAscii() == 'TACOCÆT XII'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# replace --
@wip
Scenario: replace/no_placeholder
When CEL expression "'12 days 12 hours'.replace('{0}', '2') == '12 days 12 hours'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: replace/basic
When CEL expression "'{0} days {0} hours'.replace('{0}', '2') == '2 days 2 hours'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: replace/chained
When CEL expression "'{0} days {0} hours'.replace('{0}', '2', 1).replace('{0}', '23') == '2 days 23 hours'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: replace/unicode
When CEL expression "'1 ©αT taco'.replace('αT', 'o©α') == '1 ©o©α taco'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# split --
@wip
Scenario: split/empty
When CEL expression "'hello world'.split(' ') == ['hello', 'world']" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: split/zero_limit
When CEL expression "'hello world events!'.split(' ', 0) == []" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: split/one_limit
When CEL expression "'hello world events!'.split(' ', 1) == ['hello world events!']" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: split/unicode_negative_limit
When CEL expression "'o©o©o©o'.split('©', -1) == ['o', 'o', 'o', 'o']" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# substring --
@wip
Scenario: substring/start
When CEL expression "'tacocat'.substring(4) == 'cat'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: substring/start_with_max_length
When CEL expression "'tacocat'.substring(7) == ''" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: substring/start_and_end
When CEL expression "'tacocat'.substring(0, 4) == 'taco'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: substring/start_and_end_equal_value
When CEL expression "'tacocat'.substring(4, 4) == ''" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: substring/unicode_start_and_end
When CEL expression "'ta©o©αT'.substring(2, 6) == '©o©α'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: substring/unicode_start_and_end_equal_value
When CEL expression "'ta©o©αT'.substring(7, 7) == ''" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# trim --
@wip
Scenario: trim/blank_spaces_escaped_chars
When CEL expression "' \\f\\n\\r\\t\\vtext '.trim() == 'text'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: trim/unicode_space_chars_1
When CEL expression "'\\u0085\\u00a0\\u1680text'.trim() == 'text'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: trim/unicode_space_chars_2
When CEL expression "'text\\u2000\\u2001\\u2002\\u2003\\u2004\\u2004\\u2006\\u2007\\u2008\\u2009'.trim() == 'text'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: trim/unicode_space_chars_3
When CEL expression "'\\u200atext\\u2028\\u2029\\u202F\\u205F\\u3000'.trim() == 'text'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: trim/unicode_no_trim
When CEL expression "'\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'.trim() == '\\u180etext\\u200b\\u200c\\u200d\\u2060\\ufeff'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# join --
@wip
Scenario: join/empty_separator
When CEL expression "['x', 'y'].join() == 'xy'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: join/dash_separator
When CEL expression "['x', 'y'].join('-') == 'x-y'" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: join/empty_string_empty_separator
When CEL expression "[].join() == ''" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: join/empty_string_dash_separator
When CEL expression "[].join('-') == ''" is evaluated
Then value is celpy.celtypes.BoolType(source=True)
# quote --
@wip
Scenario: quote/multiline
When CEL expression 'strings.quote("first\\nsecond") == "\\"first\\\\nsecond\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/escaped
When CEL expression 'strings.quote("bell\\a") == "\\"bell\\\\a\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/backspace
When CEL expression 'strings.quote("\\bbackspace") == "\\"\\\\bbackspace\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/form_feed
When CEL expression 'strings.quote("\\fform feed") == "\\"\\\\fform feed\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/carriage_return
When CEL expression 'strings.quote("carriage \\r return") == "\\"carriage \\\\r return\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/horizontal_tab
When CEL expression 'strings.quote("horizontal tab\\t") == "\\"horizontal tab\\\\t\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/vertical_tab
When CEL expression 'strings.quote("vertical \\v tab") == "\\"vertical \\\\v tab\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/double_slash
When CEL expression 'strings.quote("double \\\\\\\\ slash") == "\\"double \\\\\\\\\\\\\\\\ slash\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/two_escape_sequences
When CEL expression 'strings.quote("two escape sequences \\\\a\\\\n") == "\\"two escape sequences \\\\\\\\a\\\\\\\\n\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/verbatim
When CEL expression 'strings.quote("verbatim") == "\\"verbatim\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/ends_with
When CEL expression 'strings.quote("ends with \\\\") == "\\"ends with \\\\\\\\\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/starts_with
When CEL expression 'strings.quote("\\\\ starts with") == "\\"\\\\\\\\ starts with\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/printable_unicode
When CEL expression 'strings.quote("printable unicode😀") == "\\"printable unicode😀\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/mid_string_quote
When CEL expression 'strings.quote("mid string \\" quote") == "\\"mid string \\\\\\" quote\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/single_quote_with_double_quote
When CEL expression 'strings.quote(\'single-quote with "double quote"\') == "\\"single-quote with \\\\\\"double quote\\\\\\"\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/size_unicode_char
When CEL expression 'strings.quote("size(\'ÿ\')") == "\\"size(\'ÿ\')\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/size_unicode_string
When CEL expression 'strings.quote("size(\'πέντε\')") == "\\"size(\'πέντε\')\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/unicode
When CEL expression 'strings.quote("завтра") == "\\"завтра\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/unicode_code_points
When CEL expression 'strings.quote("\\U0001F431\\U0001F600\\U0001F61B")' is evaluated
Then value is celpy.celtypes.StringType(source='"🐱😀😛"')
@wip
Scenario: quote/unicode_2
When CEL expression 'strings.quote("ta©o©αT") == "\\"ta©o©αT\\""' is evaluated
Then value is celpy.celtypes.BoolType(source=True)
@wip
Scenario: quote/empty_quote
When CEL expression 'strings.quote("")' is evaluated
Then value is celpy.celtypes.StringType(source='""')
# format --
@wip
Scenario: format/no-op
When CEL expression '"no substitution".format([])' is evaluated
Then value is celpy.celtypes.StringType(source='no substitution')
@wip
Scenario: format/mid-string substitution
When CEL expression '"str is %s and some more".format(["filler"])' is evaluated
Then value is celpy.celtypes.StringType(source='str is filler and some more')
@wip
Scenario: format/percent escaping
When CEL expression '"%% and also %%".format([])' is evaluated
Then value is celpy.celtypes.StringType(source='% and also %')
@wip
Scenario: format/substitution inside escaped percent signs
When CEL expression '"%%%s%%".format(["text"])' is evaluated
Then value is celpy.celtypes.StringType(source='%text%')
@wip
Scenario: format/substitution with one escaped percent sign on the right
When CEL expression '"%s%%".format(["percent on the right"])' is evaluated
Then value is celpy.celtypes.StringType(source='percent on the right%')
@wip
Scenario: format/substitution with one escaped percent sign on the left
When CEL expression '"%%%s".format(["percent on the left"])' is evaluated
Then value is celpy.celtypes.StringType(source='%percent on the left')
@wip
Scenario: format/multiple substitutions
When CEL expression '"%d %d %d, %s %s %s, %d %d %d, %s %s %s".format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' is evaluated
Then value is celpy.celtypes.StringType(source='1 2 3, A B C, 4 5 6, D E F')
@wip
Scenario: format/percent sign escape sequence support
When CEL expression '"%%escaped %s%%".format(["percent"])' is evaluated
Then value is celpy.celtypes.StringType(source='%escaped percent%')
@wip
Scenario: format/fixed point formatting clause
When CEL expression '"%.3f".format([1.2345])' is evaluated
Then value is celpy.celtypes.StringType(source='1.234')
@wip
Scenario: format/binary formatting clause
When CEL expression '"this is 5 in binary: %b".format([5])' is evaluated
Then value is celpy.celtypes.StringType(source='this is 5 in binary: 101')
@wip
Scenario: format/uint support for binary formatting
When CEL expression '"unsigned 64 in binary: %b".format([uint(64)])' is evaluated
Then value is celpy.celtypes.StringType(source='unsigned 64 in binary: 1000000')
@wip
Scenario: format/bool support for binary formatting
When CEL expression '"bit set from bool: %b".format([true])' is evaluated
Then value is celpy.celtypes.StringType(source='bit set from bool: 1')
@wip
Scenario: format/octal formatting clause
When CEL expression '"%o".format([11])' is evaluated
Then value is celpy.celtypes.StringType(source='13')
@wip
Scenario: format/uint support for octal formatting clause
When CEL expression '"this is an unsigned octal: %o".format([uint(65535)])' is evaluated
Then value is celpy.celtypes.StringType(source='this is an unsigned octal: 177777')
@wip
Scenario: format/lowercase hexadecimal formatting clause
When CEL expression '"%x is 20 in hexadecimal".format([30])' is evaluated
Then value is celpy.celtypes.StringType(source='1e is 20 in hexadecimal')
@wip
Scenario: format/uppercase hexadecimal formatting clause
When CEL expression '"%X is 20 in hexadecimal".format([30])' is evaluated
Then value is celpy.celtypes.StringType(source='1E is 20 in hexadecimal')
@wip
Scenario: format/unsigned support for hexadecimal formatting clause
When CEL expression '"%X is 6000 in hexadecimal".format([uint(6000)])' is evaluated
Then value is celpy.celtypes.StringType(source='1770 is 6000 in hexadecimal')
@wip
Scenario: format/string support with hexadecimal formatting clause
When CEL expression '"%x".format(["Hello world!"])' is evaluated
Then value is celpy.celtypes.StringType(source='48656c6c6f20776f726c6421')
@wip
Scenario: format/string support with uppercase hexadecimal formatting clause
When CEL expression '"%X".format(["Hello world!"])' is evaluated
Then value is celpy.celtypes.StringType(source='48656C6C6F20776F726C6421')
@wip
Scenario: format/byte support with hexadecimal formatting clause
When CEL expression '"%x".format([b"byte string"])' is evaluated
Then value is celpy.celtypes.StringType(source='6279746520737472696e67')
@wip
Scenario: format/byte support with uppercase hexadecimal formatting clause
When CEL expression '"%X".format([b"byte string"])' is evaluated
Then value is celpy.celtypes.StringType(source='6279746520737472696E67')
@wip
Scenario: format/scientific notation formatting clause
When CEL expression '"%.6e".format([1052.032911275])' is evaluated
Then value is celpy.celtypes.StringType(source='1.052033e+03')
@wip
Scenario: format/default precision for fixed-point clause
When CEL expression '"%f".format([2.71828])' is evaluated
Then value is celpy.celtypes.StringType(source='2.718280')
@wip
Scenario: format/default precision for fixed-point clause with int
When CEL expression '"%f".format([2])' is evaluated
Then value is celpy.celtypes.StringType(source='2.000000')
@wip
Scenario: format/default precision for fixed-point clause with uint
When CEL expression '"%f".format([3u])' is evaluated
Then value is celpy.celtypes.StringType(source='3.000000')
@wip
Scenario: format/default precision for scientific notation
When CEL expression '"%e".format([2.71828])' is evaluated
Then value is celpy.celtypes.StringType(source='2.718280e+00')
@wip
Scenario: format/default precision for scientific notation with int
When CEL expression '"%e".format([2])' is evaluated
Then value is celpy.celtypes.StringType(source='2.000000e+00')
@wip
Scenario: format/default precision for scientific notation with uint
When CEL expression '"%e".format([3u])' is evaluated
Then value is celpy.celtypes.StringType(source='3.000000e+00')
@wip
Scenario: format/NaN support for scientific notation
When CEL expression '"%e".format([double("NaN")])' is evaluated
Then value is celpy.celtypes.StringType(source='NaN')
@wip
Scenario: format/positive infinity support for scientific notation
When CEL expression '"%e".format([double("Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='Infinity')
@wip
Scenario: format/negative infinity support for scientific notation
When CEL expression '"%e".format([double("-Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='-Infinity')
@wip
Scenario: format/NaN support for decimal
When CEL expression '"%d".format([double("NaN")])' is evaluated
Then value is celpy.celtypes.StringType(source='NaN')
@wip
Scenario: format/positive infinity support for decimal
When CEL expression '"%d".format([double("Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='Infinity')
@wip
Scenario: format/negative infinity support for decimal
When CEL expression '"%d".format([double("-Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='-Infinity')
@wip
Scenario: format/NaN support for fixed-point
When CEL expression '"%f".format([double("NaN")])' is evaluated
Then value is celpy.celtypes.StringType(source='NaN')
@wip
Scenario: format/positive infinity support for fixed-point
When CEL expression '"%f".format([double("Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='Infinity')
@wip
Scenario: format/negative infinity support for fixed-point
When CEL expression '"%f".format([double("-Infinity")])' is evaluated
Then value is celpy.celtypes.StringType(source='-Infinity')
@wip
Scenario: format/uint support for decimal clause
When CEL expression '"%d".format([uint(64)])' is evaluated
Then value is celpy.celtypes.StringType(source='64')
@wip
Scenario: format/null support for string
When CEL expression '"%s".format([null])' is evaluated
Then value is celpy.celtypes.StringType(source='null')
@wip
Scenario: format/int support for string
When CEL expression '"%s".format([999999999999])' is evaluated
Then value is celpy.celtypes.StringType(source='999999999999')
@wip
Scenario: format/bytes support for string
When CEL expression '"%s".format([b"xyz"])' is evaluated
Then value is celpy.celtypes.StringType(source='xyz')
@wip
Scenario: format/type() support for string
When CEL expression '"%s".format([type("test string")])' is evaluated
Then value is celpy.celtypes.StringType(source='string')
@wip
Scenario: format/timestamp support for string
When CEL expression '"%s".format([timestamp("2023-02-03T23:31:20+00:00")])' is evaluated
Then value is celpy.celtypes.StringType(source='2023-02-03T23:31:20Z')
@wip
Scenario: format/duration support for string
When CEL expression '"%s".format([duration("1h45m47s")])' is evaluated
Then value is celpy.celtypes.StringType(source='6347s')
@wip
Scenario: format/list support for string
When CEL expression '"%s".format([["abc", 3.14, null, [9, 8, 7, 6], timestamp("2023-02-03T23:31:20Z")]])' is evaluated
Then value is celpy.celtypes.StringType(source='[abc, 3.14, null, [9, 8, 7, 6], 2023-02-03T23:31:20Z]')
@wip
Scenario: format/map support for string
When CEL expression '"%s".format([{"key1": b"xyz", "key5": null, "key2": duration("2h"), "key4": true, "key3": 2.71828}])' is evaluated
Then value is celpy.celtypes.StringType(source='{key1: xyz, key2: 7200s, key3: 2.71828, key4: true, key5: null}')
@wip
Scenario: format/map support (all key types)
When CEL expression '"%s".format([{1: "value1", uint(2): "value2", true: double("NaN")}])' is evaluated
Then value is celpy.celtypes.StringType(source='{1: value1, 2: value2, true: NaN}')
@wip
Scenario: format/boolean support for %s
When CEL expression '"%s, %s".format([true, false])' is evaluated
Then value is celpy.celtypes.StringType(source='true, false')
@wip
Scenario: format/dyntype support for string formatting clause
When CEL expression '"%s".format([dyn("a string")])' is evaluated
Then value is celpy.celtypes.StringType(source='a string')
@wip
Scenario: format/dyntype support for numbers with string formatting clause
When CEL expression '"%s, %s".format([dyn(32), dyn(56.8)])' is evaluated
Then value is celpy.celtypes.StringType(source='32, 56.8')
@wip
Scenario: format/dyntype support for integer formatting clause
When CEL expression '"%d".format([dyn(128)])' is evaluated
Then value is celpy.celtypes.StringType(source='128')
@wip
Scenario: format/dyntype support for integer formatting clause (unsigned)
When CEL expression '"%d".format([dyn(256u)])' is evaluated
Then value is celpy.celtypes.StringType(source='256')
@wip
Scenario: format/dyntype support for hex formatting clause
When CEL expression '"%x".format([dyn(22)])' is evaluated
Then value is celpy.celtypes.StringType(source='16')
@wip
Scenario: format/dyntype support for hex formatting clause (uppercase)
When CEL expression '"%X".format([dyn(26)])' is evaluated
Then value is celpy.celtypes.StringType(source='1A')
@wip
Scenario: format/dyntype support for unsigned hex formatting clause
When CEL expression '"%x".format([dyn(500u)])' is evaluated
Then value is celpy.celtypes.StringType(source='1f4')
@wip
Scenario: format/dyntype support for fixed-point formatting clause
When CEL expression '"%.3f".format([dyn(4.5)])' is evaluated
Then value is celpy.celtypes.StringType(source='4.500')
@wip
Scenario: format/dyntype support for scientific notation
When CEL expression '"%e".format([dyn(2.71828)])' is evaluated
Then value is celpy.celtypes.StringType(source='2.718280e+00')
@wip
Scenario: format/dyntype NaN/infinity support
When CEL expression '"%s".format([[double("NaN"), double("Infinity"), double("-Infinity")]])' is evaluated
Then value is celpy.celtypes.StringType(source='[NaN, Infinity, -Infinity]')
@wip
Scenario: format/dyntype support for timestamp
When CEL expression '"%s".format([dyn(timestamp("2009-11-10T23:00:00Z"))])' is evaluated
Then value is celpy.celtypes.StringType(source='2009-11-10T23:00:00Z')
@wip
Scenario: format/dyntype support for duration
When CEL expression '"%s".format([dyn(duration("8747s"))])' is evaluated
Then value is celpy.celtypes.StringType(source='8747s')
@wip
Scenario: format/dyntype support for lists
When CEL expression '"%s".format([dyn([6, 4.2, "a string"])])' is evaluated
Then value is celpy.celtypes.StringType(source='[6, 4.2, a string]')
@wip
Scenario: format/dyntype support for maps
When CEL expression '"%s".format([{"strKey":"x", 6:duration("422s"), true:42}])' is evaluated
Then value is celpy.celtypes.StringType(source='{6: 422s, strKey: x, true: 42}')
@wip
Scenario: format/string substitution in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%s')
When CEL expression 'str_var.format(["filler"])' is evaluated
Then value is celpy.celtypes.StringType(source='filler')
@wip
Scenario: format/multiple substitutions in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%d %d %d, %s %s %s, %d %d %d, %s %s %s')
When CEL expression 'str_var.format([1, 2, 3, "A", "B", "C", 4, 5, 6, "D", "E", "F"])' is evaluated
Then value is celpy.celtypes.StringType(source='1 2 3, A B C, 4 5 6, D E F')
@wip
Scenario: format/substitution inside escaped percent signs in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%%%s%%')
When CEL expression 'str_var.format(["text"])' is evaluated
Then value is celpy.celtypes.StringType(source='%text%')
@wip
Scenario: format/fixed point formatting clause in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%.3f')
When CEL expression 'str_var.format([1.2345])' is evaluated
Then value is celpy.celtypes.StringType(source='1.234')
@wip
Scenario: format/binary formatting clause in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%b')
When CEL expression 'str_var.format([5])' is evaluated
Then value is celpy.celtypes.StringType(source='101')
@wip
Scenario: format/scientific notation formatting clause in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%.6e')
When CEL expression 'str_var.format([1052.032911275])' is evaluated
Then value is celpy.celtypes.StringType(source='1.052033e+03')
@wip
Scenario: format/default precision for fixed-point clause in a string variable
Given type_env parameter "str_var" is celpy.celtypes.StringType
and bindings parameter "str_var" is celpy.celtypes.StringType(source='%f')
When CEL expression 'str_var.format([2.71828])' is evaluated
Then value is celpy.celtypes.StringType(source='2.718280')
@wip
Scenario: format/format_%f_insignificant_zeroes_removed
When CEL expression '"%.0f".format([123.000000])' is evaluated
Then value is celpy.celtypes.StringType(source='123')
@wip
Scenario: format/format_%f_positive_round_to_whole_number
When CEL expression '"%.0f".format([3.5001])' is evaluated
Then value is celpy.celtypes.StringType(source='4')
@wip
Scenario: format/format_%f_negative_truncate_to_whole_number
When CEL expression '"%.0f".format([3.4999])' is evaluated
Then value is celpy.celtypes.StringType(source='3')
@wip
Scenario: format/format_%f_halfway_round_up_to_nearest_even
When CEL expression '"%.0f".format([1.5])' is evaluated
Then value is celpy.celtypes.StringType(source='2')
@wip
Scenario: format/format_%f_halfway_truncate_to_nearest_even
When CEL expression '"%.0f".format([2.5])' is evaluated
Then value is celpy.celtypes.StringType(source='2')
@wip
Scenario: format/format_%f_positive_round_up
When CEL expression '"%.3f".format([123.4999])' is evaluated
Then value is celpy.celtypes.StringType(source='123.500')
@wip
Scenario: format/format_%f_positive_round_down
When CEL expression '"%.3f".format([123.4994])' is evaluated
Then value is celpy.celtypes.StringType(source='123.499')
@wip
Scenario: format/format_%f_negative_round_up
When CEL expression '"%.3f".format([-123.4999])' is evaluated
Then value is celpy.celtypes.StringType(source='-123.500')
@wip