]> git.lizzy.rs Git - rust.git/commitdiff
rename call_drop_ tests to drop_
authorRalf Jung <post@ralfj.de>
Thu, 7 Nov 2019 07:56:11 +0000 (08:56 +0100)
committerRalf Jung <post@ralfj.de>
Thu, 7 Nov 2019 07:56:11 +0000 (08:56 +0100)
12 files changed:
tests/run-pass/call_drop_on_array_elements.rs [deleted file]
tests/run-pass/call_drop_on_fat_ptr_array_elements.rs [deleted file]
tests/run-pass/call_drop_on_zst_array_elements.rs [deleted file]
tests/run-pass/call_drop_through_owned_slice.rs [deleted file]
tests/run-pass/call_drop_through_trait_object.rs [deleted file]
tests/run-pass/call_drop_through_trait_object_rc.rs [deleted file]
tests/run-pass/drop_on_array_elements.rs [new file with mode: 0644]
tests/run-pass/drop_on_fat_ptr_array_elements.rs [new file with mode: 0644]
tests/run-pass/drop_on_zst_array_elements.rs [new file with mode: 0644]
tests/run-pass/drop_through_owned_slice.rs [new file with mode: 0644]
tests/run-pass/drop_through_trait_object.rs [new file with mode: 0644]
tests/run-pass/drop_through_trait_object_rc.rs [new file with mode: 0644]

diff --git a/tests/run-pass/call_drop_on_array_elements.rs b/tests/run-pass/call_drop_on_array_elements.rs
deleted file mode 100644 (file)
index c9b59f6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-struct Bar(u16); // ZSTs are tested separately
-
-static mut DROP_COUNT: usize = 0;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        assert_eq!(self.0 as usize, unsafe { DROP_COUNT }); // tests whether we are called at a valid address
-        unsafe { DROP_COUNT += 1; }
-    }
-}
-
-fn main() {
-    let b = [Bar(0), Bar(1), Bar(2), Bar(3)];
-    assert_eq!(unsafe { DROP_COUNT }, 0);
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-
-    // check empty case
-    let b : [Bar; 0] = [];
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-}
diff --git a/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs b/tests/run-pass/call_drop_on_fat_ptr_array_elements.rs
deleted file mode 100644 (file)
index 36162d3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-trait Foo {}
-
-struct Bar;
-
-impl Foo for Bar {}
-
-static mut DROP_COUNT: usize = 0;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        unsafe { DROP_COUNT += 1; }
-    }
-}
-
-fn main() {
-    let b: [Box<dyn Foo>; 4] = [Box::new(Bar), Box::new(Bar), Box::new(Bar), Box::new(Bar)];
-    assert_eq!(unsafe { DROP_COUNT }, 0);
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-}
diff --git a/tests/run-pass/call_drop_on_zst_array_elements.rs b/tests/run-pass/call_drop_on_zst_array_elements.rs
deleted file mode 100644 (file)
index 1887130..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-struct Bar;
-
-static mut DROP_COUNT: usize = 0;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        unsafe { DROP_COUNT += 1; }
-    }
-}
-
-fn main() {
-    let b = [Bar, Bar, Bar, Bar];
-    assert_eq!(unsafe { DROP_COUNT }, 0);
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-
-    // check empty case
-    let b : [Bar; 0] = [];
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-}
diff --git a/tests/run-pass/call_drop_through_owned_slice.rs b/tests/run-pass/call_drop_through_owned_slice.rs
deleted file mode 100644 (file)
index 3ec6be6..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-struct Bar;
-
-static mut DROP_COUNT: usize = 0;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        unsafe { DROP_COUNT += 1; }
-    }
-}
-
-fn main() {
-    let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice();
-    assert_eq!(unsafe { DROP_COUNT }, 0);
-    drop(b);
-    assert_eq!(unsafe { DROP_COUNT }, 4);
-}
diff --git a/tests/run-pass/call_drop_through_trait_object.rs b/tests/run-pass/call_drop_through_trait_object.rs
deleted file mode 100644 (file)
index 97ba69c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-trait Foo {}
-
-struct Bar;
-
-static mut DROP_CALLED: bool = false;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        unsafe { DROP_CALLED = true; }
-    }
-}
-
-impl Foo for Bar {}
-
-fn main() {
-    let b: Box<dyn Foo> = Box::new(Bar);
-    assert!(unsafe { !DROP_CALLED });
-    drop(b);
-    assert!(unsafe { DROP_CALLED });
-}
diff --git a/tests/run-pass/call_drop_through_trait_object_rc.rs b/tests/run-pass/call_drop_through_trait_object_rc.rs
deleted file mode 100644 (file)
index 172a458..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-trait Foo {}
-
-struct Bar;
-
-static mut DROP_CALLED: bool = false;
-
-impl Drop for Bar {
-    fn drop(&mut self) {
-        unsafe { DROP_CALLED = true; }
-    }
-}
-
-impl Foo for Bar {}
-
-use std::rc::Rc;
-
-fn main() {
-    let b: Rc<dyn Foo> = Rc::new(Bar);
-    assert!(unsafe { !DROP_CALLED });
-    drop(b);
-    assert!(unsafe { DROP_CALLED });
-}
diff --git a/tests/run-pass/drop_on_array_elements.rs b/tests/run-pass/drop_on_array_elements.rs
new file mode 100644 (file)
index 0000000..c9b59f6
--- /dev/null
@@ -0,0 +1,22 @@
+struct Bar(u16); // ZSTs are tested separately
+
+static mut DROP_COUNT: usize = 0;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        assert_eq!(self.0 as usize, unsafe { DROP_COUNT }); // tests whether we are called at a valid address
+        unsafe { DROP_COUNT += 1; }
+    }
+}
+
+fn main() {
+    let b = [Bar(0), Bar(1), Bar(2), Bar(3)];
+    assert_eq!(unsafe { DROP_COUNT }, 0);
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+
+    // check empty case
+    let b : [Bar; 0] = [];
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+}
diff --git a/tests/run-pass/drop_on_fat_ptr_array_elements.rs b/tests/run-pass/drop_on_fat_ptr_array_elements.rs
new file mode 100644 (file)
index 0000000..36162d3
--- /dev/null
@@ -0,0 +1,20 @@
+trait Foo {}
+
+struct Bar;
+
+impl Foo for Bar {}
+
+static mut DROP_COUNT: usize = 0;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        unsafe { DROP_COUNT += 1; }
+    }
+}
+
+fn main() {
+    let b: [Box<dyn Foo>; 4] = [Box::new(Bar), Box::new(Bar), Box::new(Bar), Box::new(Bar)];
+    assert_eq!(unsafe { DROP_COUNT }, 0);
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+}
diff --git a/tests/run-pass/drop_on_zst_array_elements.rs b/tests/run-pass/drop_on_zst_array_elements.rs
new file mode 100644 (file)
index 0000000..1887130
--- /dev/null
@@ -0,0 +1,21 @@
+struct Bar;
+
+static mut DROP_COUNT: usize = 0;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        unsafe { DROP_COUNT += 1; }
+    }
+}
+
+fn main() {
+    let b = [Bar, Bar, Bar, Bar];
+    assert_eq!(unsafe { DROP_COUNT }, 0);
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+
+    // check empty case
+    let b : [Bar; 0] = [];
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+}
diff --git a/tests/run-pass/drop_through_owned_slice.rs b/tests/run-pass/drop_through_owned_slice.rs
new file mode 100644 (file)
index 0000000..3ec6be6
--- /dev/null
@@ -0,0 +1,16 @@
+struct Bar;
+
+static mut DROP_COUNT: usize = 0;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        unsafe { DROP_COUNT += 1; }
+    }
+}
+
+fn main() {
+    let b: Box<[Bar]> = vec![Bar, Bar, Bar, Bar].into_boxed_slice();
+    assert_eq!(unsafe { DROP_COUNT }, 0);
+    drop(b);
+    assert_eq!(unsafe { DROP_COUNT }, 4);
+}
diff --git a/tests/run-pass/drop_through_trait_object.rs b/tests/run-pass/drop_through_trait_object.rs
new file mode 100644 (file)
index 0000000..97ba69c
--- /dev/null
@@ -0,0 +1,20 @@
+trait Foo {}
+
+struct Bar;
+
+static mut DROP_CALLED: bool = false;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        unsafe { DROP_CALLED = true; }
+    }
+}
+
+impl Foo for Bar {}
+
+fn main() {
+    let b: Box<dyn Foo> = Box::new(Bar);
+    assert!(unsafe { !DROP_CALLED });
+    drop(b);
+    assert!(unsafe { DROP_CALLED });
+}
diff --git a/tests/run-pass/drop_through_trait_object_rc.rs b/tests/run-pass/drop_through_trait_object_rc.rs
new file mode 100644 (file)
index 0000000..172a458
--- /dev/null
@@ -0,0 +1,22 @@
+trait Foo {}
+
+struct Bar;
+
+static mut DROP_CALLED: bool = false;
+
+impl Drop for Bar {
+    fn drop(&mut self) {
+        unsafe { DROP_CALLED = true; }
+    }
+}
+
+impl Foo for Bar {}
+
+use std::rc::Rc;
+
+fn main() {
+    let b: Rc<dyn Foo> = Rc::new(Bar);
+    assert!(unsafe { !DROP_CALLED });
+    drop(b);
+    assert!(unsafe { DROP_CALLED });
+}