Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit f059df8

Browse files
committed
move the nothrow dtor test to object.d
1 parent 8278f71 commit f059df8

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/object.d

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,21 @@ nothrow @safe @nogc unittest
882882
}
883883
}
884884

885+
// Test to ensure proper behavior of `nothrow` destructors
886+
nothrow unittest
887+
{
888+
class C
889+
{
890+
static int dtorCount = 0;
891+
this() nothrow {}
892+
~this() nothrow { dtorCount++; }
893+
}
894+
895+
auto c = new C;
896+
destroy(c);
897+
assert(C.dtorCount == 1);
898+
}
899+
885900
/// ditto
886901
void destroy(bool initialize = true, T : U[n], U, size_t n)(ref T obj) if (!is(T == struct))
887902
{

test/exceptions/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
include ../common.mak
22

33
TESTS=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dtor \
4-
future_message rt_trap_exceptions_drt catch_in_finally nothrow_dtor
4+
future_message rt_trap_exceptions_drt catch_in_finally
55

66
ifeq ($(OS)-$(BUILD),linux-debug)
77
TESTS+=line_trace long_backtrace_trunc rt_trap_exceptions
@@ -64,7 +64,6 @@ $(ROOT)/static_dtor.done: STDERR_EXP="dtor_called_more_than_once"
6464
$(ROOT)/future_message.done: STDERR_EXP="exception I have a custom message. exception exception "
6565
$(ROOT)/static_dtor.done: NEGATE=!
6666
$(ROOT)/catch_in_finally.done: STDERR_EXP="success."
67-
$(ROOT)/nothrow_dtor.done: STDERR_EXP="success."
6867
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP="object.Exception@src/rt_trap_exceptions.d(12): this will abort"
6968
$(ROOT)/rt_trap_exceptions.done: STDERR_EXP2="src/rt_trap_exceptions.d:8 main"
7069
$(ROOT)/assert_fail.done: STDERR_EXP="success."

test/exceptions/src/nothrow_dtor.d

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)