aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2019-01-17 20:54:31 +0800
committerLeonardo Alt <leo@ethereum.org>2019-01-17 21:28:03 +0800
commit83e7233bb8923a83d7ecc093dae88b140336a137 (patch)
treebb0af447868101e4b36aa594c0e3170e9860d440 /test
parentc96b760c472a134c59deb20c27e5252319c74e2b (diff)
downloaddexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.gz
dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.tar.zst
dexon-solidity-83e7233bb8923a83d7ecc093dae88b140336a137.zip
Change error message and add tests
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_fractional.sol7
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol9
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol8
-rw-r--r--test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol10
4 files changed, 34 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_fractional.sol
new file mode 100644
index 00000000..16c76d9a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_fractional.sol
@@ -0,0 +1,7 @@
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encode(0.1, 1);
+ }
+}
+// ----
+// TypeError: (92-95): Fractional numbers cannot yet be encoded.
diff --git a/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol
new file mode 100644
index 00000000..80efa9c5
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_fractional_abiencoderv2.sol
@@ -0,0 +1,9 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encode(0.1, 1);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (126-129): Fractional numbers cannot yet be encoded.
diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol
new file mode 100644
index 00000000..71080cb0
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional.sol
@@ -0,0 +1,8 @@
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encodePacked(0.1, 1);
+ }
+}
+// ----
+// TypeError: (98-101): Fractional numbers cannot yet be encoded.
+// TypeError: (103-104): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.
diff --git a/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol
new file mode 100644
index 00000000..e82c3c9a
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/encoding_packed_fractional_abiencoderv2.sol
@@ -0,0 +1,10 @@
+pragma experimental ABIEncoderV2;
+contract C {
+ function f1() public pure returns (bytes memory) {
+ return abi.encodePacked(0.1, 1);
+ }
+}
+// ----
+// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
+// TypeError: (132-135): Fractional numbers cannot yet be encoded.
+// TypeError: (137-138): Cannot perform packed encoding for a literal. Please convert it to an explicit type first.