aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-04-24 12:09:51 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-04-24 12:09:51 -0700
commit8ad75a9bf3a7fa9782bf17165fa6d7dc842efb51 (patch)
tree342f75149314e8505eb5a85decd675e0731d6921 /test/run_tests.cpp
parent46ab981787a108ad4326c86aa2a6af4247e7191b (diff)
downloadzig-8ad75a9bf3a7fa9782bf17165fa6d7dc842efb51.tar.gz
zig-8ad75a9bf3a7fa9782bf17165fa6d7dc842efb51.zip
add compile error for invalid equality operator uses
See #145
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index d8f3c9a41d..09b86dc7a5 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1218,6 +1218,21 @@ fn test_a_thing() {
bad_fn_call();
}
)SOURCE", 1, ".tmp_source.zig:6:5: error: use of undeclared identifier 'bad_fn_call'");
+
+ add_compile_fail_case("illegal comparison of types", R"SOURCE(
+fn bad_eql_1(a: []u8, b: []u8) -> bool {
+ a == b
+}
+enum EnumWithData {
+ One,
+ Two: i32,
+}
+fn bad_eql_2(a: EnumWithData, b: EnumWithData) -> bool {
+ a == b
+}
+ )SOURCE", 2,
+ ".tmp_source.zig:3:7: error: operator not allowed for type '[]u8'",
+ ".tmp_source.zig:10:7: error: operator not allowed for type 'EnumWithData'");
}
//////////////////////////////////////////////////////////////////////////////