mindsbackyard / galvanic-test

A test environment for rust: test cases & suites, fixtures, and parameterised test cases
Apache License 2.0
52 stars 3 forks source link

Members Trailing Comma #18

Open gatoWololo opened 5 years ago

gatoWololo commented 5 years ago

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.

erayerdin commented 4 years ago

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

erayerdin commented 4 years ago

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.