aboutsummaryrefslogtreecommitdiff
path: root/test-suite
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-07-11 15:17:23 -0500
committerGitHub <noreply@github.com>2018-07-11 15:17:23 -0500
commit010ae9ffde22a2ed045e8042cd05db42f4adeefa (patch)
treea70fcd12f4b1591e94ac2207c6a18fa836ef4dc6 /test-suite
parent2a24f054f0f51974ffe08d67052318586716d925 (diff)
parentec939223aa53ab4d422a136cff154a6b9afab5bb (diff)
downloadmilf-rs-010ae9ffde22a2ed045e8042cd05db42f4adeefa.tar.gz
milf-rs-010ae9ffde22a2ed045e8042cd05db42f4adeefa.zip
Merge pull request #249 from ehuss/int-radix
0.5: Support hex/oct/bin integers.
Diffstat (limited to 'test-suite')
-rw-r--r--test-suite/tests/invalid-misc.rs4
-rw-r--r--test-suite/tests/valid/integer.json10
-rw-r--r--test-suite/tests/valid/integer.toml14
3 files changed, 27 insertions, 1 deletions
diff --git a/test-suite/tests/invalid-misc.rs b/test-suite/tests/invalid-misc.rs
index 218be4f..80421e3 100644
--- a/test-suite/tests/invalid-misc.rs
+++ b/test-suite/tests/invalid-misc.rs
@@ -11,6 +11,10 @@ fn bad() {
bad("a = 1_");
bad("''");
bad("a = 9e99999");
+
bad("a = \"\u{7f}\"");
bad("a = '\u{7f}'");
+
+ bad("a = -0x1");
+ bad("a = 0x-1");
}
diff --git a/test-suite/tests/valid/integer.json b/test-suite/tests/valid/integer.json
index 86f779f..77ecb6c 100644
--- a/test-suite/tests/valid/integer.json
+++ b/test-suite/tests/valid/integer.json
@@ -1,6 +1,14 @@
{
"answer": {"type": "integer", "value": "42"},
"neganswer": {"type": "integer", "value": "-42"},
+
"neg_zero": {"type": "integer", "value": "0"},
- "pos_zero": {"type": "integer", "value": "0"}
+ "pos_zero": {"type": "integer", "value": "0"},
+
+ "hex1": {"type": "integer", "value": "3735928559"},
+ "hex2": {"type": "integer", "value": "3735928559"},
+ "hex3": {"type": "integer", "value": "3735928559"},
+ "oct1": {"type": "integer", "value": "342391"},
+ "oct2": {"type": "integer", "value": "493"},
+ "bin1": {"type": "integer", "value": "214"}
}
diff --git a/test-suite/tests/valid/integer.toml b/test-suite/tests/valid/integer.toml
index 2bdca34..8362459 100644
--- a/test-suite/tests/valid/integer.toml
+++ b/test-suite/tests/valid/integer.toml
@@ -1,4 +1,18 @@
answer = 42
neganswer = -42
+
neg_zero = -0
pos_zero = +0
+
+# hexadecimal with prefix `0x`
+hex1 = 0xDEADBEEF
+hex2 = 0xdeadbeef
+hex3 = 0xdead_beef
+
+# octal with prefix `0o`
+oct1 = 0o01234567
+oct2 = 0o755 # useful for Unix file permissions
+
+# binary with prefix `0b`
+bin1 = 0b11010110
+