aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-05-25 07:27:48 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-05-27 03:39:10 +0800
commit3b75c5b45fdb1bfb49b4e157e031154c57b475f3 (patch)
tree674ec4c1e3bf9413f4e986819db76aeede77f5d2 /test
parentdda497ca027f5dcd47c6e2b8d624b327c4478adc (diff)
downloaddexon-solidity-3b75c5b45fdb1bfb49b4e157e031154c57b475f3.tar.gz
dexon-solidity-3b75c5b45fdb1bfb49b4e157e031154c57b475f3.tar.zst
dexon-solidity-3b75c5b45fdb1bfb49b4e157e031154c57b475f3.zip
Validate that only basic types are used in Julia
Diffstat (limited to 'test')
-rw-r--r--test/libjulia/Parser.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp
index 31dbd278..71b5bb06 100644
--- a/test/libjulia/Parser.cpp
+++ b/test/libjulia/Parser.cpp
@@ -110,7 +110,6 @@ do \
BOOST_CHECK(searchErrorMessage(err, (substring))); \
} while(0)
-
BOOST_AUTO_TEST_SUITE(JuliaParser)
BOOST_AUTO_TEST_CASE(smoke_test)
@@ -197,6 +196,31 @@ BOOST_AUTO_TEST_CASE(lacking_types)
CHECK_ERROR("{ function f(a:u256) -> b {} }", ParserError, "Expected token Colon got 'LBrace'");
}
+BOOST_AUTO_TEST_CASE(invalid_types)
+{
+ /// testing invalid literal
+ /// NOTE: these will need to change when types are compared
+ CHECK_ERROR("{ let x:bool := 1:invalid }", TypeError, "User defined types (\"invalid\") are not supported yet.");
+ /// testing invalid variable declaration
+ CHECK_ERROR("{ let x:invalid := 1:bool }", TypeError, "User defined types (\"invalid\") are not supported yet.");
+ CHECK_ERROR("{ function f(a:invalid) {} }", TypeError, "User defined types (\"invalid\") are not supported yet.");
+}
+
+BOOST_AUTO_TEST_CASE(builtin_types)
+{
+ BOOST_CHECK(successParse("{ let x:bool := true:bool }"));
+ BOOST_CHECK(successParse("{ let x:u8 := 1:u8 }"));
+ BOOST_CHECK(successParse("{ let x:s8 := 1:u8 }"));
+ BOOST_CHECK(successParse("{ let x:u32 := 1:u32 }"));
+ BOOST_CHECK(successParse("{ let x:s32 := 1:s32 }"));
+ BOOST_CHECK(successParse("{ let x:u64 := 1:u64 }"));
+ BOOST_CHECK(successParse("{ let x:s64 := 1:s64 }"));
+ BOOST_CHECK(successParse("{ let x:u128 := 1:u128 }"));
+ BOOST_CHECK(successParse("{ let x:s128 := 1:s128 }"));
+ BOOST_CHECK(successParse("{ let x:u256 := 1:u256 }"));
+ BOOST_CHECK(successParse("{ let x:s256 := 1:s256 }"));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}