summaryrefslogtreecommitdiffstats
path: root/tests/ui/opeq.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/opeq.rs')
-rw-r--r--tests/ui/opeq.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/opeq.rs b/tests/ui/opeq.rs
new file mode 100644
index 000000000..9737be97f
--- /dev/null
+++ b/tests/ui/opeq.rs
@@ -0,0 +1,17 @@
+// run-pass
+
+pub fn main() {
+ let mut x: isize = 1;
+ x *= 2;
+ println!("{}", x);
+ assert_eq!(x, 2);
+ x += 3;
+ println!("{}", x);
+ assert_eq!(x, 5);
+ x *= x;
+ println!("{}", x);
+ assert_eq!(x, 25);
+ x /= 5;
+ println!("{}", x);
+ assert_eq!(x, 5);
+}