aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-09-21 11:47:10 -0700
committerGraydon Hoare <[email protected]>2010-09-21 11:47:10 -0700
commit9f0a6c21b2de2247eccbfb1b72137db5c7dd5173 (patch)
treec4929a54a7ff40ab4b252e32e7aa548320304258 /src/test
parentAdd QUES to comp/fe/lexer.rs, rustc can self-lex again. (diff)
downloadrust-9f0a6c21b2de2247eccbfb1b72137db5c7dd5173.tar.xz
rust-9f0a6c21b2de2247eccbfb1b72137db5c7dd5173.zip
Implement preliminary form of structured compare. No boxes, vectors or strings yet.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/structured-compare.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs
new file mode 100644
index 00000000..fed4b183
--- /dev/null
+++ b/src/test/run-pass/structured-compare.rs
@@ -0,0 +1,20 @@
+tag foo {
+ large;
+ small;
+}
+
+fn main() {
+ auto a = tup(1,2,3);
+ auto b = tup(1,2,3);
+ check (a == b);
+ check (a != tup(1,2,4));
+ check (a < tup(1,2,4));
+ check (a <= tup(1,2,4));
+ check (tup(1,2,4) > a);
+ check (tup(1,2,4) >= a);
+ auto x = large;
+ auto y = small;
+ check (x != y);
+ check (x == large);
+ check (x != small);
+} \ No newline at end of file