Skip to content

Organising golden files #2

@szg251

Description

@szg251

I have the tests for multiple serialisation methods (bytestring, Debug, Display, etc), and my test structure looks something like this:

mod display_tests {
  #[test]
  fn some_data() {
    goldie::assert!(test_data.to_string())
  }
  #[test]
  fn some_other_data() {
    goldie::assert!(other_test_data.to_string())
  }
}
mod debug_tests {
  #[test]
  fn some_data() {
    goldie::assert_debug!(test_data)
  }
  #[test]
  fn some_other_data() {
    goldie::assert_debug!(other_test_data)
  }
}

Currently the goldens from the second module would override the files from the first.

testdata/some_data.golden
testdata/some_other_data.golden

It would be nice to have the golden files follow the module structure, something like this:

testdata/display_tests/some_data.golden
testdata/debug_tests/some_other_data.golden

or alternatively to have the option to pass a custom path for the goldens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions