[Xfce4-commits] <midori:master> Fix unit test for unique download filenames
Christian Dywan
noreply at xfce.org
Wed Nov 7 01:22:01 CET 2012
Updating branch refs/heads/master
to e7c1bd33df1e40bbdaf72b929d8049d6e060b6e1 (commit)
from 37da0eff2338bdf61e3071d56efc87e08f11b19d (commit)
commit e7c1bd33df1e40bbdaf72b929d8049d6e060b6e1
Author: Paweł Forysiuk <tuxator at o2.pl>
Date: Tue Nov 6 22:31:55 2012 +0100
Fix unit test for unique download filenames
tests/download.vala | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/download.vala b/tests/download.vala
index 746cba2..fc213db 100644
--- a/tests/download.vala
+++ b/tests/download.vala
@@ -41,20 +41,23 @@ static void download_extension () {
static void download_unique () {
string folder = DirUtils.make_tmp ("cacheXXXXXX");
string filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo.png");
- string unique = Midori.Download.get_unique_filename (filename);
+ string org_filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo.png");
+ string unique = Midori.Download.get_unique_filename (org_filename);
Katze.assert_str_equal (folder, unique, filename);
FileUtils.set_contents (filename, "12345");
- unique = Midori.Download.get_unique_filename (filename);
+ unique = Midori.Download.get_unique_filename (org_filename);
filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo-0.png");
Katze.assert_str_equal (folder, unique, filename);
FileUtils.set_contents (filename, "12345");
- unique = Midori.Download.get_unique_filename (filename);
+ unique = Midori.Download.get_unique_filename (org_filename);
filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo-1.png");
Katze.assert_str_equal (folder, unique, filename);
- filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo-9.png");
- FileUtils.set_contents (filename, "12345");
- unique = Midori.Download.get_unique_filename (filename);
+ for (var i = 0; i < 10; i++) {
+ filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo-%d.png".printf (i));
+ FileUtils.set_contents (filename, "12345");
+ }
+ unique = Midori.Download.get_unique_filename (org_filename);
filename = Path.build_path (Path.DIR_SEPARATOR_S, folder, "foo-10.png");
Katze.assert_str_equal (folder, unique, filename);
DirUtils.remove (folder);
More information about the Xfce4-commits
mailing list