Code review comment for lp:~xavi-garcia-mena/mediascanner2/ms-dbus-wal

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Looking quite nice. However one thing that is a bit concerning is that the tests duplicate a lot of code in the dbus and non-dbus cases. Would it be possible to consolidate these so that every test is run with common code. So something along the lines of this:

void testImplementation(MediaStore &writer, MediaStore &queryer) {
  // First set up
  writer.insert(whatevs);

  // Then query
  ASSERT_EQ(queryer.query("..."), result);
}

And then have the actual dbus and non-dbus test cases just do basically this:

void testWithoutDbus() {
  MediaStore local(READWRITE);

  testImplementation(local, local);
}

void testWithDbus() {
  MediaStore writer(READWRITE);
  MediaStore queryer(READONLY);

  testImplementation(writer, queryer);
}

review: Needs Fixing

« Back to merge proposal