galvanic-test icon indicating copy to clipboard operation
galvanic-test copied to clipboard

Members Trailing Comma

Open gatoWololo opened this issue 6 years ago • 2 comments

Hello, thank you for the great library! I'm finding it very useful.

A small thing I ran into, there can be no trailing comma on the last member:

members {
            process: Option<Child>,
            mount_dir: Option<PathBuf>,
            real_dir: Option<PathBuf>,
        }

With the trailing comma I get the error:

error: expected one of `!` or `::`, found `detfs_setup`
  --> tests/detfs_tests.rs:16:13
   |
16 |     fixture detfs_setup(dir: String) -> PathBuf {
   |             ^^^^^^^^^^^ expected one of `!` or `::` here

error: aborting due to previous error

error: Could not compile `detfs`.

Getting rid of the comma fixes it, but the error does not make it obvious.

gatoWololo avatar Jan 31 '19 16:01 gatoWololo

Same here with a fixture. Example code:

fixture keys_dir() -> PathBuf {
        setup(&mut self) {
            let keys_dir = get_keys_pdir();
            fs::create_dir_all(&keys_dir).unwrap();
            keys_dir
        }

        tear_down(&mut self) {
            fs::remove_dir_all(self.val);
        }
    }

with output below:

   --> src/data/auth.rs:110:13
    |
110 |     fixture keys_dir() -> PathBuf {
    |             ^^^^^^^^ expected one of `!` or `::` here

error: aborting due to previous error

Environment

  • rustc and cargo 1.40.0 (stable)
  • galvanic-test: 0.2.0

erayerdin avatar Mar 04 '20 00:03 erayerdin

Ok, I have solved my issue somehow but this "expected one of ! or :: here" error might mean something else is wrong with the code. Even in some cases, like borrowing and moving errors, the compiler might complain with the said error. Idk why.

erayerdin avatar Mar 04 '20 12:03 erayerdin