Unit Tests #9

Merged
lx merged 4 commits from feature/unit-tests into master 2020-11-08 12:41:00 +00:00
Owner

There are (at least) 3 class of tests in Rust:

  • Unit Tests
  • Integration Tests
  • Documentation Tests

When reading the code, I wanted to really understand how parse_bucket_key works and it appears that tests are really great at explaining such things.
Ideally, I wanted to write a documentation tests, to explain at the same time with a natural language how it works. However it appears that documentation tests can not easily be used with private functions, which explains why I fell back to unit tests.

I don't know how we want to work: merge unit tests one by one or in a batch? With or without PR?
So let's start the discussion here!

There are (at least) 3 class of tests in Rust: - Unit Tests - Integration Tests - Documentation Tests When reading the code, I wanted to really understand how `parse_bucket_key` works and it appears that tests are really great at explaining such things. Ideally, I wanted to write a documentation tests, to explain at the same time with a natural language how it works. However it appears that documentation tests can not easily be used with private functions, which explains why I fell back to unit tests. I don't know how we want to work: merge unit tests one by one or in a batch? With or without PR? So let's start the discussion here!
Owner

It's probably better to do a PR so that I can check that the test is correct. If you're done writing tests for now, don't wait to make a PR. If you're writing a series of tests for a bunch of functions in the same module, make a single PR for them.

It's probably better to do a PR so that I can check that the test is correct. If you're done writing tests for now, don't wait to make a PR. If you're writing a series of tests for a bunch of functions in the same module, make a single PR for them.
quentin changed title from WIP: Unit Tests to Unit Tests 2020-11-07 14:35:14 +00:00
Author
Owner

Done for today, I added a second test, you can merge.

What is the point of returning a result in this function as there is no way this function can fail?

Done for today, I added a second test, you can merge. What is the point of returning a result in this function as there is no way this function can fail?
Owner

Because there is a bug. The function should fail if bucket is the empty string.

Because there is a bug. The function should fail if bucket is the empty string.
lx merged commit 18aab38a6a into master 2020-11-08 12:40:59 +00:00
quentin deleted branch feature/unit-tests 2020-11-08 14:54:35 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Deuxfleurs/garage#9
No description provided.