Beispiel #1
0
        public void test006_ReadUglyConfig()
        {
            RepositoryConfig c   = db.Config;
            string           cfg = Path.Combine(db.Directory.FullName, "config");

            string configStr = "  [core];comment\n\tfilemode = yes\n"
                               + "[user]\n"
                               + "  email = A U Thor <*****@*****.**> # Just an example...\n"
                               + " name = \"A  Thor \\\\ \\\"\\t \"\n"
                               + "    defaultCheckInComment = a many line\\n\\\ncomment\\n\\\n"
                               + " to test\n";

            File.WriteAllText(cfg, configStr);
            c.load();
            Assert.AreEqual("yes", c.getString("core", null, "filemode"));
            Assert.AreEqual("A U Thor <*****@*****.**>", c
                            .getString("user", null, "email"));
            Assert.AreEqual("A  Thor \\ \"\t ", c.getString("user", null, "name"));
            Assert.AreEqual("a many line\ncomment\n to test", c.getString("user", null, "defaultCheckInComment"));
            c.save();
            var configStr1 = File.ReadAllText(cfg);

            Assert.AreEqual(configStr, configStr1);
        }