[geary/wip/181-special-folder-dupes] Fix pathological FolderPath.is_equal() case, add unit test
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/181-special-folder-dupes] Fix pathological FolderPath.is_equal() case, add unit test
- Date: Mon, 14 Jan 2019 07:09:23 +0000 (UTC)
commit fcb6e5f91f261f11050c950fc1f4eb6f9b157338
Author: Michael Gratton <mike vee net>
Date: Mon Jan 14 18:03:47 2019 +1100
Fix pathological FolderPath.is_equal() case, add unit test
src/engine/api/geary-folder-path.vala | 2 +-
test/engine/api/geary-folder-path-test.vala | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/engine/api/geary-folder-path.vala b/src/engine/api/geary-folder-path.vala
index 4f01d168..a33ade74 100644
--- a/src/engine/api/geary-folder-path.vala
+++ b/src/engine/api/geary-folder-path.vala
@@ -207,7 +207,7 @@ public class Geary.FolderPath :
FolderPath? a = this;
FolderPath? b = other;
- while (a != null && b != null) {
+ while (a != null || b != null) {
if (a == b) {
return true;
}
diff --git a/test/engine/api/geary-folder-path-test.vala b/test/engine/api/geary-folder-path-test.vala
index c1c16643..18db7308 100644
--- a/test/engine/api/geary-folder-path-test.vala
+++ b/test/engine/api/geary-folder-path-test.vala
@@ -134,6 +134,12 @@ public class Geary.FolderPathTest : TestCase {
.equal_to(this.root.get_child("test2").get_child("test")),
"Disjoint parents"
);
+
+ assert_false(
+ this.root.get_child("test").equal_to(
+ this.root.get_child("").get_child("test")),
+ "Pathological case"
+ );
}
public void path_hash() throws GLib.Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]