aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-05-05 10:06:34 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-05-05 10:06:34 -0500
commit2b112ebfadb6b6d19553722eca91b797ad60f303 (patch)
tree815b73d07410af48e294b08babab2cf817415251 /tests
parent4008e0a91ebdc1cf5c5715a122fed318124c8802 (diff)
downloadayatana-indicator-datetime-2b112ebfadb6b6d19553722eca91b797ad60f303.tar.gz
ayatana-indicator-datetime-2b112ebfadb6b6d19553722eca91b797ad60f303.tar.bz2
ayatana-indicator-datetime-2b112ebfadb6b6d19553722eca91b797ad60f303.zip
when src/timezone-file.c reads the contents of a file, skip lines that begin with '#' because they're comments. Add test.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-timezone-file.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test-timezone-file.cpp b/tests/test-timezone-file.cpp
index 453b353..aec597c 100644
--- a/tests/test-timezone-file.cpp
+++ b/tests/test-timezone-file.cpp
@@ -131,3 +131,16 @@ TEST_F(TimezoneFixture, ChangedValue)
ASSERT_TRUE(changed);
ASSERT_EQ(changed_timezone, tz.timezone.get());
}
+
+
+/**
+ * Test that timezone-file picks up the initial value
+ */
+TEST_F(TimezoneFixture, IgnoreComments)
+{
+ const std::string comment = "# Created by cloud-init v. 0.7.5 on Thu, 24 Apr 2014 14:03:29 +0000";
+ const std::string expected_timezone = "Europe/Berlin";
+ set_file(comment + "\n" + expected_timezone);
+ FileTimezone tz(TIMEZONE_FILE);
+ ASSERT_EQ(expected_timezone, tz.timezone.get());
+}