On 08/29/2012 11:35 AM, Emmanuel Surleau wrote:

[snip]

Given a lot of assumptions about what might ultimately be available
in the language, this looks like the beginnings of a workable
design. Unfortunately, given the stateful nature of a test suite,
you aren't going to be able to run the tests in parallel (just
entire suites).

Assuming the necessary machinery is in place, what's keeping you from creating
one instance of the suite per test, and putting each of them in their own task?

In which case, having a constructor and a destructor instead of setup/teardown
would make more sense.

I think that sort of model does make more sense for Rust, but I see the setup/teardown thing as the distinctive part of the xUnit design. It may be so awkward with Rust that we shouldn't try to copy it.

If you did that then a complete test suit might look like:

trait TestSuite: drop {

  static fn new() -> self;

  fn drop() { ... }
}

struct MyTestSuite {
  ...
}

impl MyTestSuite: TestSuite {

  static fn new() -> self { ... }

  fn drop() { }

  fn test1() { }

  fn test2() { }
}

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to