Mercurial > vim
annotate src/testdir/test_format.vim @ 34686:83875247fbc0 v9.1.0224
patch 9.1.0224: cursor may move too many lines over "right" & "below" virt text
Commit: https://github.com/vim/vim/commit/515f734e687f28f7199b2a8042197624d9f3ec15
Author: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
Date: Thu Mar 28 12:01:14 2024 +0100
patch 9.1.0224: cursor may move too many lines over "right" & "below" virt text
Problem: If a line has "right" & "below" virtual text properties,
where the "below" property may be stored first due to lack of
ordering between them, then the line height is calculated to
be 1 more and causes the cursor to far over the line.
Solution: Remove some unnecessary setting of a
`next_right_goes_below = TRUE` flag for "below" and "above"
text properties. (Dylan Thacker-Smith)
I modified a regression test I recently added to cover this case,
leveraging the fact that "after", "right" & "below" text properties are
being stored in the reverse of the order they are added in. The
previous version of this regression test was crafted to workaround this
issue so it can be addressed by this separate patch.
closes: #14317
Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Mar 2024 12:15:03 +0100 |
parents | 0adcad161c46 |
children |
rev | line source |
---|---|
32775
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1 " Tests for expressions. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 source check.vim |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 import './vim9.vim' as v9 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 func Test_printf_pos_misc() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 let lines =<< trim END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call assert_equal('123', printf('%1$d', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call assert_equal('', printf('%1$.0d', 0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call assert_equal('00005', printf('%1$5.5d', 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call assert_equal('00005', printf('%1$*1$.5d', 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 call assert_equal('00005', printf('%1$5.*1$d', 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal('00005', printf('%1$*1$.*1$d', 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_equal('00005', printf('%1$*10$.5d%2$.0d%3$.0d%4$.0d%5$.0d%6$.0d%7$.0d%8$.0d%9$.0d', 5, 0, 0, 0, 0, 0, 0, 0, 0, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal('00005', printf('%1$5.*10$d%2$.0d%3$.0d%4$.0d%5$.0d%6$.0d%7$.0d%8$.0d%9$.0d', 5, 0, 0, 0, 0, 0, 0, 0, 0, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_equal('123', printf('%1$i', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal('123', printf('%1$D', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call assert_equal('123', printf('%1$U', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 call assert_equal('173', printf('%1$o', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 call assert_equal('173', printf('%1$O', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 call assert_equal('7b', printf('%1$x', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 call assert_equal('7B', printf('%1$X', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 call assert_equal('Printing 1 at width 1 gives: 1', 1->printf("Printing %1$d at width %1$d gives: %1$*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 call assert_equal('Printing 2 at width 2 gives: 2', 2->printf("Printing %1$d at width %1$d gives: %1$*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 call assert_equal('Printing 3 at width 3 gives: 3', 3->printf("Printing %1$d at width %1$d gives: %1$*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 call assert_equal('Printing 1 at width/precision 1.1 gives: 1', 1->printf("Printing %1$d at width/precision %1$d.%1$d gives: %1$*1$.*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 call assert_equal('Printing 2 at width/precision 2.2 gives: 02', 2->printf("Printing %1$d at width/precision %1$d.%1$d gives: %1$*1$.*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 call assert_equal('Printing 3 at width/precision 3.3 gives: 003', 3->printf("Printing %1$d at width/precision %1$d.%1$d gives: %1$*1$.*1$d")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 call assert_equal('123', printf('%1$hd', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 call assert_equal('-123', printf('%1$hd', -123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 call assert_equal('-1', printf('%1$hd', 0xFFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 call assert_equal('-1', printf('%1$hd', 0x1FFFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 call assert_equal('123', printf('%1$hu', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 call assert_equal('65413', printf('%1$hu', -123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 call assert_equal('65535', printf('%1$hu', 0xFFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
38 call assert_equal('65535', printf('%1$hu', 0x1FFFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 call assert_equal('123', printf('%1$ld', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 call assert_equal('-123', printf('%1$ld', -123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 call assert_equal('65535', printf('%1$ld', 0xFFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
43 call assert_equal('131071', printf('%1$ld', 0x1FFFF)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 call assert_equal('{', printf('%1$c', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 call assert_equal('abc', printf('%1$s', 'abc')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 call assert_equal('abc', printf('%1$S', 'abc')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 call assert_equal('+123', printf('%1$+d', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 call assert_equal('-123', printf('%1$+d', -123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 call assert_equal('+123', printf('%1$+ d', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 call assert_equal(' 123', printf('%1$ d', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 call assert_equal(' 123', printf('%1$ d', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 call assert_equal('-123', printf('%1$ d', -123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 call assert_equal(' 123', printf('%2$*1$d', 5, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 call assert_equal('123 ', printf('%2$*1$d', -5, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 call assert_equal('00123', printf('%2$.*1$d', 5, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 call assert_equal(' 123', printf('%2$ *1$d', 5, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call assert_equal(' +123', printf('%2$+ *1$d', 5, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call assert_equal(' 123', printf('%1$*2$d', 123, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 call assert_equal('123 ', printf('%1$*2$d', 123, -5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
64 call assert_equal('00123', printf('%1$.*2$d', 123, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 call assert_equal(' 123', printf('%1$ *2$d', 123, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 call assert_equal(' +123', printf('%1$+ *2$d', 123, 5)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
68 call assert_equal('foobar', printf('%2$.*1$s', 9, 'foobar')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 call assert_equal('foo', printf('%2$.*1$s', 3, 'foobar')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 call assert_equal('', printf('%2$.*1$s', 0, 'foobar')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 call assert_equal('foobar', printf('%2$.*1$s', -1, 'foobar')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 #" Unrecognized format specifier kept as-is. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 call assert_equal('_123', printf("%_%1$d", 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 #" Test alternate forms. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 call assert_equal('0x7b', printf('%1$#x', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
78 call assert_equal('0X7B', printf('%1$#X', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 call assert_equal('0173', printf('%1$#o', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 call assert_equal('0173', printf('%1$#O', 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 call assert_equal('abc', printf('%1$#s', 'abc')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 call assert_equal('abc', printf('%1$#S', 'abc')) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 call assert_equal('1%', printf('%1$d%%', 1)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 call assert_notequal('', printf('%1$p', "abc")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 call assert_notequal('', printf('%2$d %1$p %3$s', "abc", 2, "abc")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
87 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 #" Try argument re-use and argument swapping |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 call assert_equal('one two one', printf('%1$s %2$s %1$s', "one", "two")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 call assert_equal('Screen height: 400', printf('%1$s height: %2$d', "Screen", 400)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
91 call assert_equal('400 is: Screen height', printf('%2$d is: %1$s height', "Screen", 400)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 #" Try out lots of combinations of argument types to skip |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
94 call assert_equal('9 12345 7654321', printf('%2$ld %1$d %3$lu', 12345, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 call assert_equal('9 1234567 7654321', printf('%2$d %1$ld %3$lu', 1234567, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
96 call assert_equal('9 1234567 7654321', printf('%2$d %1$lld %3$lu', 1234567, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 call assert_equal('9 12345 7654321', printf('%2$ld %1$u %3$lu', 12345, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 call assert_equal('9 1234567 7654321', printf('%2$d %1$lu %3$lu', 1234567, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 call assert_equal('9 1234567 7654321', printf('%2$d %1$llu %3$lu', 1234567, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 call assert_equal('9 1234567 7654321', printf('%2$d %1$llu %3$lu', 1234567, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 call assert_equal('9 deadbeef 7654321', printf('%2$d %1$x %3$lu', 0xdeadbeef, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
102 call assert_equal('9 c 7654321', printf('%2$ld %1$c %3$lu', 99, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 call assert_equal('9 hi 7654321', printf('%2$ld %1$s %3$lu', "hi", 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 call assert_equal('9 0.000000e+00 7654321', printf('%2$ld %1$e %3$lu', 0.0, 9, 7654321)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 call v9.CheckLegacyAndVim9Success(lines) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 func Test_printf_pos_float() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 let lines =<< trim END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 call assert_equal('1.000000', printf('%1$f', 1)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 call assert_equal('1.230000', printf('%1$f', 1.23)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 call assert_equal('1.230000', printf('%1$F', 1.23)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 call assert_equal('9999999.9', printf('%1$g', 9999999.9)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 call assert_equal('9999999.9', printf('%1$G', 9999999.9)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
117 call assert_equal('1.230000e+00', printf('%1$e', 1.23)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 call assert_equal('1.230000E+00', printf('%1$E', 1.23)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 call assert_equal('1.200000e-02', printf('%1$e', 0.012)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 call assert_equal('-1.200000e-02', printf('%1$e', -0.012)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
121 call assert_equal('0.33', printf('%1$.2f', 1.0 / 3.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 #" When precision is 0, the dot should be omitted. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 call assert_equal(' 2', printf('%1$*2$.f', 7.0 / 3.0, 3)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 call assert_equal(' 2', printf('%2$*1$.f', 3, 7.0 / 3.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 call assert_equal(' 2', printf('%1$*2$.g', 7.0 / 3.0, 3)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 call assert_equal(' 2', printf('%2$*1$.g', 3, 7.0 / 3.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 call assert_equal(' 2e+00', printf('%1$*2$.e', 7.0 / 3.0, 7)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 call assert_equal(' 2e+00', printf('%2$*1$.e', 7, 7.0 / 3.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 #" Float zero can be signed. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 call assert_equal('+0.000000', printf('%1$+f', 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 call assert_equal('0.000000', printf('%1$f', 1.0 / (1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 call assert_equal('-0.000000', printf('%1$f', 1.0 / (-1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 call assert_equal('0.0', printf('%1$s', 1.0 / (1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 call assert_equal('-0.0', printf('%1$s', 1.0 / (-1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 call assert_equal('0.0', printf('%1$S', 1.0 / (1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 call assert_equal('-0.0', printf('%1$S', 1.0 / (-1.0 / 0.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 #" Float infinity can be signed. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 call assert_equal('inf', printf('%1$f', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 call assert_equal('-inf', printf('%1$f', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 call assert_equal('inf', printf('%1$g', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 call assert_equal('-inf', printf('%1$g', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 call assert_equal('inf', printf('%1$e', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 call assert_equal('-inf', printf('%1$e', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 call assert_equal('INF', printf('%1$F', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 call assert_equal('-INF', printf('%1$F', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 call assert_equal('INF', printf('%1$E', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 call assert_equal('-INF', printf('%1$E', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 call assert_equal('INF', printf('%1$E', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 call assert_equal('-INF', printf('%1$G', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 call assert_equal('+inf', printf('%1$+f', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 call assert_equal('-inf', printf('%1$+f', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 call assert_equal(' inf', printf('%1$ f', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 call assert_equal(' inf', printf('%1$*2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 call assert_equal(' -inf', printf('%1$*2$f', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 call assert_equal(' inf', printf('%1$*2$g', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 call assert_equal(' -inf', printf('%1$*2$g', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 call assert_equal(' +inf', printf('%1$+*2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
161 call assert_equal(' inf', printf('%1$ *2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 call assert_equal(' +inf', printf('%1$+0*2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 call assert_equal('inf ', printf('%1$-*2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 call assert_equal('-inf ', printf('%1$-*2$f', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 call assert_equal('+inf ', printf('%1$-+*2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 call assert_equal(' inf ', printf('%1$- *2$f', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 call assert_equal('-INF ', printf('%1$-*2$F', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 call assert_equal('+INF ', printf('%1$-+*2$F', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
169 call assert_equal(' INF ', printf('%1$- *2$F', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
170 call assert_equal('INF ', printf('%1$-*2$G', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
171 call assert_equal('-INF ', printf('%1$-*2$G', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
172 call assert_equal('INF ', printf('%1$-*2$E', 1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 call assert_equal('-INF ', printf('%1$-*2$E', -1.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
174 call assert_equal(' inf', printf('%2$*1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
175 call assert_equal(' -inf', printf('%2$*1$f', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 call assert_equal(' inf', printf('%2$*1$g', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 call assert_equal(' -inf', printf('%2$*1$g', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 call assert_equal(' +inf', printf('%2$+*1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 call assert_equal(' inf', printf('%2$ *1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 call assert_equal(' +inf', printf('%2$+0*1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 call assert_equal('inf ', printf('%2$-*1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 call assert_equal('-inf ', printf('%2$-*1$f', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 call assert_equal('+inf ', printf('%2$-+*1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 call assert_equal(' inf ', printf('%2$- *1$f', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 call assert_equal('-INF ', printf('%2$-*1$F', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
186 call assert_equal('+INF ', printf('%2$-+*1$F', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 call assert_equal(' INF ', printf('%2$- *1$F', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 call assert_equal('INF ', printf('%2$-*1$G', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 call assert_equal('-INF ', printf('%2$-*1$G', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 call assert_equal('INF ', printf('%2$-*1$E', 6, 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 call assert_equal('-INF ', printf('%2$-*1$E', 6, -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
192 call assert_equal('inf', printf('%1$s', 1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
193 call assert_equal('-inf', printf('%1$s', -1.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
194 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 #" Test special case where max precision is truncated at 340. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%1$.*2$f', 1.0, 330)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
197 call assert_equal('1.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%2$.*1$f', 330, 1.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%1$.*2$f', 1.0, 340)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%2$.*1$f', 340, 1.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
200 call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%1$.*2$f', 1.0, 350)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 call assert_equal('1.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', printf('%2$.*1$f', 350, 1.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 #" Float nan (not a number) has no sign. |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 call assert_equal('nan', printf('%1$f', sqrt(-1.0))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 call assert_equal('nan', printf('%1$f', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 call assert_equal('nan', printf('%1$f', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 call assert_equal('nan', printf('%1$g', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 call assert_equal('nan', printf('%1$e', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
209 call assert_equal('NAN', printf('%1$F', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 call assert_equal('NAN', printf('%1$G', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 call assert_equal('NAN', printf('%1$E', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 call assert_equal('NAN', printf('%1$F', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
213 call assert_equal('NAN', printf('%1$G', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 call assert_equal('NAN', printf('%1$E', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 call assert_equal(' nan', printf('%1$*2$f', 0.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
216 call assert_equal(' nan', printf('%1$0*2$f', 0.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 call assert_equal('nan ', printf('%1$-*2$f', 0.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 call assert_equal('nan ', printf('%1$- *2$f', 0.0 / 0.0, 6)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 call assert_equal(' nan', printf('%2$*1$f', 6, 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 call assert_equal(' nan', printf('%2$0*1$f', 6, 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 call assert_equal('nan ', printf('%2$-*1$f', 6, 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 call assert_equal('nan ', printf('%2$- *1$f', 6, 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 call assert_equal('nan', printf('%1$s', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 call assert_equal('nan', printf('%1$s', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 call assert_equal('nan', printf('%1$S', 0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 call assert_equal('nan', printf('%1$S', -0.0 / 0.0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 call v9.CheckLegacyAndVim9Success(lines) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
229 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
230 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
231 func Test_printf_pos_errors() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", {})'], 'E728:') |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", [])'], 'E745:') |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
234 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", 1, 2)'], 'E767:') |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 call v9.CheckLegacyAndVim9Failure(['echo printf("%*d", 1)'], 'E766:') |
33383
5c12ca4dcd45
patch 9.0.1950: Vim9: error codes spread out
Christian Brabandt <cb@256bit.org>
parents:
32775
diff
changeset
|
236 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$s")'], 'E1503:') |
32775
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$d", 1.2)'], 'E805:') |
33383
5c12ca4dcd45
patch 9.0.1950: Vim9: error codes spread out
Christian Brabandt <cb@256bit.org>
parents:
32775
diff
changeset
|
238 call v9.CheckLegacyAndVim9Failure(['echo printf("%1$f")'], 'E1503:') |
34561
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
239 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
240 call v9.CheckLegacyAndVim9Failure(['echo printf("%f", "a")'], 'E807:') |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
241 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
242 call v9.CheckLegacyAndVim9Failure(["call printf('%1$d%2$d', 1, 3, 4)"], "E767:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
243 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
244 call v9.CheckLegacyAndVim9Failure(["call printf('%2$d%d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
245 call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
246 call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d%d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
247 call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$*1$d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
248 call v9.CheckLegacyAndVim9Failure(["call printf('%2$.*1$d%d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
249 call v9.CheckLegacyAndVim9Failure(["call printf('%d%2$.*1$d', 1, 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
250 call v9.CheckLegacyAndVim9Failure(["call printf('%1$%')"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
251 call v9.CheckLegacyAndVim9Failure(["call printf('%1$')"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
252 call v9.CheckLegacyAndVim9Failure(["call printf('%1$_')"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
253 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
254 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*2$d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
255 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*.*d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
256 call v9.CheckLegacyAndVim9Failure(["call printf('%*.*1$d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
257 call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
258 call v9.CheckLegacyAndVim9Failure(["call printf('%*1$.*1$d', 3)"], "E1500:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
259 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
260 call v9.CheckLegacyAndVim9Failure(["call printf('%2$d', 3, 3)"], "E1501:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
261 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
262 call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$d %1$ld', 3, 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
263 call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
264 call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
265 call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
266 call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
267 call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
268 call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
269 call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
270 call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
271 call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$*1$d', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
272 call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %2$*1$d', 3, 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
273 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$ld', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
274 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.*1$ld', 3)"], "E1502:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
275 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
276 call v9.CheckLegacyAndVim9Failure(["call printf('%1$d%2$d', 3)"], "E1503:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
277 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
278 call v9.CheckLegacyAndVim9Failure(["call printf('%1$d %1$s', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
279 call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$s', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
280 call v9.CheckLegacyAndVim9Failure(["call printf('%1$ud %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
281 call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$f', 3.0)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
282 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$d %1$ld', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
283 call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
284 call v9.CheckLegacyAndVim9Failure(["call printf('%1$p %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
285 call v9.CheckLegacyAndVim9Failure(["call printf('%1$f %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
286 call v9.CheckLegacyAndVim9Failure(["call printf('%1$lud %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
287 call v9.CheckLegacyAndVim9Failure(["call printf('%1$llud %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
288 call v9.CheckLegacyAndVim9Failure(["call printf('%1$lld %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
289 call v9.CheckLegacyAndVim9Failure(["call printf('%1$s %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
290 call v9.CheckLegacyAndVim9Failure(["call printf('%1$c %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
291 call v9.CheckLegacyAndVim9Failure(["call printf('%1$ld %1$d', 3)"], "E1504:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
292 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
293 call v9.CheckLegacyAndVim9Failure(["call printf('%1$.2$d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
294 call v9.CheckLegacyAndVim9Failure(["call printf('%01$d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
295 call v9.CheckLegacyAndVim9Failure(["call printf('%01$0d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
296 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
297 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3.*2$d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
298 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.2$d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
299 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*3$.*2d', 3)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
300 call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.5d', 5)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
301 call v9.CheckLegacyAndVim9Failure(["call printf('%1$5.1$d', 5)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
302 call v9.CheckLegacyAndVim9Failure(["call printf('%1$1$.1$d', 5)"], "E1505:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
303 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
304 call v9.CheckLegacyAndVim9Failure(["call printf('%.123456789$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
305 call v9.CheckLegacyAndVim9Failure(["call printf('%.123456789d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
306 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
307 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
308 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
309 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$5.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
310 call v9.CheckLegacyAndVim9Failure(["call printf('%1$123456789.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
311 call v9.CheckLegacyAndVim9Failure(["call printf('%1$5.123456789d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
312 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$987654321.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
313 call v9.CheckLegacyAndVim9Failure(["call printf('%1$123456789.987654321d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
314 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$5.987654321d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
315 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
316 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*1$.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
317 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*123456789$.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
318 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.123456789d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
319 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*987654321$.5d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
320 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*123456789$.987654321d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
321 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*1$.987654321d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
322 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
323 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$5.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
324 call v9.CheckLegacyAndVim9Failure(["call printf('%1$123456789.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
325 call v9.CheckLegacyAndVim9Failure(["call printf('%1$5.*123456789$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
326 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$987654321.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
327 call v9.CheckLegacyAndVim9Failure(["call printf('%1$123456789.*987654321$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
328 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$5.*987654321$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
329 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
330 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*1$.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
331 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*123456789$.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
332 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.*123456789d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
333 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*987654321$.*1$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
334 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*123456789$.*987654321$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
335 call v9.CheckLegacyAndVim9Failure(["call printf('%123456789$*1$.*987654321$d', 5)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
336 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
337 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2$.*1$d', 5, 9999)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
338 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*1$.*2$d', 5, 9999)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
339 call v9.CheckLegacyAndVim9Failure(["call printf('%2$*3$.*1$d', 5, 9123, 9321)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
340 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2$.*3$d', 5, 9123, 9321)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
341 call v9.CheckLegacyAndVim9Failure(["call printf('%2$*1$.*3$d', 5, 9123, 9312)"], "E1510:") |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
342 |
0adcad161c46
patch 9.1.0181: no overflow check for string formatting
Christian Brabandt <cb@256bit.org>
parents:
33383
diff
changeset
|
343 call v9.CheckLegacyAndVim9Failure(["call printf('%1$*2$d', 5, 9999)"], "E1510:") |
32775
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
344 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
345 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
346 func Test_printf_pos_64bit() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
347 let lines =<< trim END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
348 call assert_equal("123456789012345", printf('%1$d', 123456789012345)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
349 END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
350 call v9.CheckLegacyAndVim9Success(lines) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
351 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
352 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
353 func Test_printf_pos_spec_s() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
354 let lines =<< trim END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
355 #" number |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
356 call assert_equal("1234567890", printf('%1$s', 1234567890)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
357 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
358 #" string |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
359 call assert_equal("abcdefgi", printf('%1$s', "abcdefgi")) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
360 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
361 #" float |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 call assert_equal("1.23", printf('%1$s', 1.23)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
363 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 #" list |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 VAR lvalue = [1, 'two', ['three', 4]] |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
366 call assert_equal(string(lvalue), printf('%1$s', lvalue)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
367 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
368 #" dict |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
369 VAR dvalue = {'key1': 'value1', 'key2': ['list', 'lvalue'], 'key3': {'dict': 'lvalue'}} |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
370 call assert_equal(string(dvalue), printf('%1$s', dvalue)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
371 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
372 #" funcref |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
373 call assert_equal('printf', printf('%1$s', 'printf'->function())) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
374 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
375 #" partial |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
376 call assert_equal(string(function('printf', ['%1$s'])), printf('%1$s', function('printf', ['%1$s']))) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
377 END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
378 call v9.CheckLegacyAndVim9Success(lines) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
379 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
380 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
381 func Test_printf_pos_spec_b() |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
382 let lines =<< trim END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
383 call assert_equal("0", printf('%1$b', 0)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
384 call assert_equal("00001100", printf('%1$0*2$b', 12, 8)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
385 call assert_equal("11111111", printf('%1$0*2$b', 0xff, 8)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
386 call assert_equal(" 1111011", printf('%1$*2$b', 123, 10)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
387 call assert_equal("0001111011", printf('%1$0*2$b', 123, 10)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
388 call assert_equal(" 0b1111011", printf('%1$#*2$b', 123, 10)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
389 call assert_equal("0B01111011", printf('%1$#0*2$B', 123, 10)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
390 call assert_equal("00001100", printf('%2$0*1$b', 8, 12)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
391 call assert_equal("11111111", printf('%2$0*1$b', 8, 0xff)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
392 call assert_equal(" 1111011", printf('%2$*1$b', 10, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
393 call assert_equal("0001111011", printf('%2$0*1$b', 10, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
394 call assert_equal(" 0b1111011", printf('%2$#*1$b', 10, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
395 call assert_equal("0B01111011", printf('%2$#0*1$B', 10, 123)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
396 call assert_equal("1001001100101100000001011010010", printf('%1$b', 1234567890)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 call assert_equal("11100000100100010000110000011011101111101111001", printf('%1$b', 123456789012345)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
398 call assert_equal("1111111111111111111111111111111111111111111111111111111111111111", printf('%1$b', -1)) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
399 END |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
400 call v9.CheckLegacyAndVim9Success(lines) |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
401 endfunc |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
402 |
2d5e8c46508b
patch 9.0.1704: Cannot use positional arguments for printf()
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
403 " vim: shiftwidth=2 sts=2 expandtab |