]> git.donarmstrong.com Git - perltidy.git/commitdiff
add test for parsing numeric values
authorSteve Hancock <perltidy@users.sourceforge.net>
Thu, 27 May 2021 13:55:16 +0000 (06:55 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Thu, 27 May 2021 13:55:16 +0000 (06:55 -0700)
t/snippets/expect/numbers.def [new file with mode: 0644]
t/snippets/numbers.in [new file with mode: 0644]
t/snippets/packing_list.txt
t/snippets24.t

diff --git a/t/snippets/expect/numbers.def b/t/snippets/expect/numbers.def
new file mode 100644 (file)
index 0000000..7571cbe
--- /dev/null
@@ -0,0 +1,23 @@
+# valid numbers
+my @vals = (
+
+    12345,
+    12345.67,
+    .23E-10,
+    3.14_15_92,
+    4_294_967_296,
+    0xff,
+    0xdead_beef,
+    0377,
+    0b011011,
+    0x1.999ap-4,
+    1e34,
+    1e+34,
+    1e+034,
+    -1e+034,
+    0.00000000000000000000000000000000000000000000000000000000000000000001,
+    0Xabcdef,
+    0B1101,
+    0o12_345,    # optional 'o' and 'O' added in perl v5.33.5
+    0O12_345,
+);
diff --git a/t/snippets/numbers.in b/t/snippets/numbers.in
new file mode 100644 (file)
index 0000000..4d24499
--- /dev/null
@@ -0,0 +1,23 @@
+# valid numbers
+my @vals = (
+
+    12345,
+    12345.67,
+    .23E-10,
+    3.14_15_92,
+    4_294_967_296,
+    0xff,
+    0xdead_beef,
+    0377,
+    0b011011,
+    0x1.999ap-4,
+    1e34,
+    1e+34,
+    1e+034,
+    -1e+034,
+    0.00000000000000000000000000000000000000000000000000000000000000000001,
+    0Xabcdef,
+    0B1101,
+    0o12_345,  # optional 'o' and 'O' added in perl v5.33.5
+    0O12_345,
+);
index 8b38f8b9e2f2cfba2700b33ec7db5556dfc65462..1e6f8f26dd407adb99ce7ec731ef3b0439afc5f9 100644 (file)
 ../snippets9.t rt98902.def
 ../snippets9.t rt98902.rt98902
 ../snippets9.t rt99961.def
+../snippets24.t        numbers.def
index f171b4bd7fc2a73f61cf4611dc75e53acd37091a..b570477fa2c1428cd932446c0feed43ef9703a06 100644 (file)
@@ -15,6 +15,7 @@
 #12 align35.def
 #13 rt136417.def
 #14 rt136417.rt136417
+#15 numbers.def
 
 # To locate test #13 you can search for its name or the string '#13'
 
@@ -207,6 +208,32 @@ $behaviour = {
              };
 ----------
 
+        'numbers' => <<'----------',
+# valid numbers
+my @vals = (
+
+    12345,
+    12345.67,
+    .23E-10,
+    3.14_15_92,
+    4_294_967_296,
+    0xff,
+    0xdead_beef,
+    0377,
+    0b011011,
+    0x1.999ap-4,
+    1e34,
+    1e+34,
+    1e+034,
+    -1e+034,
+    0.00000000000000000000000000000000000000000000000000000000000000000001,
+    0Xabcdef,
+    0B1101,
+    0o12_345,  # optional 'o' and 'O' added in perl v5.33.5
+    0O12_345,
+);
+----------
+
         'rt136417' => <<'----------',
 function(
   #
@@ -776,6 +803,36 @@ function(
 );
 #14...........
         },
+
+        'numbers.def' => {
+            source => "numbers",
+            params => "def",
+            expect => <<'#15...........',
+# valid numbers
+my @vals = (
+
+    12345,
+    12345.67,
+    .23E-10,
+    3.14_15_92,
+    4_294_967_296,
+    0xff,
+    0xdead_beef,
+    0377,
+    0b011011,
+    0x1.999ap-4,
+    1e34,
+    1e+34,
+    1e+034,
+    -1e+034,
+    0.00000000000000000000000000000000000000000000000000000000000000000001,
+    0Xabcdef,
+    0B1101,
+    0o12_345,    # optional 'o' and 'O' added in perl v5.33.5
+    0O12_345,
+);
+#15...........
+        },
     };
 
     my $ntests = 0 + keys %{$rtests};