Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On 05/17/2016 10:22 AM, Meta wrote: On Tuesday, 17 May 2016 at 09:54:15 UTC, Marc Schütz wrote: You surely mean "used to be destroy", right? Good question... If I write this: struct Test { ~this() { writeln("destroying Test"); } } with (Test()) { //Do stuff } Will Test's destructor be run once we exit the `with` scope? Should.
Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On Tuesday, 17 May 2016 at 14:22:51 UTC, Meta wrote: On Tuesday, 17 May 2016 at 09:54:15 UTC, Marc Schütz wrote: You surely mean "used to be destroy", right? Good question... If I write this: struct Test { ~this() { writeln("destroying Test"); } } with (Test()) { //Do stuff } Will Test's destructor be run once we exit the `with` scope? Yes, it was fixed almost two years ago: https://github.com/dlang/dmd/pull/3855
Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On Tuesday, 17 May 2016 at 14:22:51 UTC, Meta wrote: On Tuesday, 17 May 2016 at 09:54:15 UTC, Marc Schütz wrote: You surely mean "used to be destroy", right? Good question... If I write this: struct Test { ~this() { writeln("destroying Test"); } } with (Test()) { //Do stuff } Will Test's destructor be run once we exit the `with` scope? It did for me on the latest release. Atila
Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On Tuesday, 17 May 2016 at 09:54:15 UTC, Marc Schütz wrote: You surely mean "used to be destroy", right? Good question... If I write this: struct Test { ~this() { writeln("destroying Test"); } } with (Test()) { //Do stuff } Will Test's destructor be run once we exit the `with` scope?
Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On Monday, 16 May 2016 at 14:39:22 UTC, Meta wrote: On Monday, 16 May 2016 at 08:37:48 UTC, Atila Neves wrote: with(immutable Sandbox()) { writeFile("foo.txt", "foobarbaz\ntoto"); // can also pass string[] for lines shouldExist("foo.txt"); shouldNotExist("bar.txt"); shouldEqualLines("foo.txt", ["foobarbaz", "toto"]); } That's a really neat trick and an interesting use of `with`. I remember that variables initialized in the argument list of `with` used to not be destroyed after exiting the scope, I'm guessing that's not the case anymore? I vaguely remember a PR that fixed that. You surely mean "used to be destroy", right? Yes, that's been fixed. Anyway, congratulations on the new release!
Re: unit-threaded v0.6.13 - tags, autotags and support for integration tests
On Monday, 16 May 2016 at 08:37:48 UTC, Atila Neves wrote: with(immutable Sandbox()) { writeFile("foo.txt", "foobarbaz\ntoto"); // can also pass string[] for lines shouldExist("foo.txt"); shouldNotExist("bar.txt"); shouldEqualLines("foo.txt", ["foobarbaz", "toto"]); } That's a really neat trick and an interesting use of `with`. I remember that variables initialized in the argument list of `with` used to not be destroyed after exiting the scope, I'm guessing that's not the case anymore? I vaguely remember a PR that fixed that. Anyway, congratulations on the new release!