Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ts-bugfix.cpp « tests - github.com/windirstat/simpleini.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e449092fb7a86be0eb11ccfa644c5b82d305a36f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "pch.h"
#include "../SimpleIni.h"

TEST(TestBugFix, TestEmptySection) {
	CSimpleIniA ini;
	ini.SetValue("foo", "skey", "sval");
	ini.SetValue("", "rkey", "rval");
	ini.SetValue("bar", "skey", "sval");

	std::string output;
	ini.Save(output);

	std::string expected =
		"rkey = rval\n"
		"\n"
		"\n"
		"[foo]\n"
		"skey = sval\n"
		"\n"
		"\n"
		"[bar]\n"
		"skey = sval\n";

	output.erase(std::remove(output.begin(), output.end(), '\r'), output.end());
	ASSERT_STREQ(expected.c_str(), output.c_str());
}