Skip to content

Commit 0f5e567

Browse files
authored
Merge pull request #105 from karanankit01/cov-test
add test case for space_before_call in test_config.cpp
2 parents 46e8624 + c99db21 commit 0f5e567

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/Config.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace fs = filesystem;
99

1010
Config::Config() {
11-
// Defaul configuration
11+
// Default configuration
1212
node_["column_limit"] = 80;
1313
node_["indent_width"] = 4;
1414
node_["use_tab"] = false;
@@ -42,7 +42,7 @@ Config::Config() {
4242
node_["single_quote_to_double_quote"] = false;
4343
}
4444

45-
void Config::readFromFile(const string& file) {
45+
void Config::readFromFile(const string &file) {
4646
fs::file_status status = fs::status(file);
4747
fs::perms perm = status.permissions();
4848

@@ -67,6 +67,6 @@ void Config::readFromFile(const string& file) {
6767
}
6868
}
6969

70-
void Config::dumpCurrent(ofstream& fout) { fout << node_ << endl; }
70+
void Config::dumpCurrent(ofstream &fout) { fout << node_ << endl; }
7171

72-
void Config::dumpCurrent(ostream& out) { out << node_ << endl; }
72+
void Config::dumpCurrent(ostream &out) { out << node_ << endl; }

test/test_config.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ TEST_CASE("column_limit", "config") {
3434
lua_format("function W() q(aaaa,bbbb) print(aaaa,bbbb) end", config));
3535
}
3636

37+
TEST_CASE("spaces_before_call", "config") {
38+
Config config;
39+
config.set("indent_width", 4);
40+
config.set("continuation_indent_width", 4);
41+
config.set("column_limit", 40);
42+
config.set("spaces_before_call", 0);
43+
REQUIRE("function t() return function() end end\nlocal a = t{1, 2, 3, 4}\nlocal a = t{1}\nlocal a = t{8}\nlocal a = t{1, 9}\nlocal a = t(1, 2, 3)\nt{2, 3} {1, 5}\nt{2, 3, 4} {1}\n" ==
44+
lua_format("function t() return function () end end local a = t{1, 2, 3, 4} local a = t {1} local a = t{8} local a = t {1,9} local a = t(1, 2, 3) t {2, 3}{1,5} t{2, 3, 4}{1}", config));
45+
}
46+
3747
TEST_CASE("table_sep", "config") {
3848
Config config;
3949
config.set("indent_width", 2);

0 commit comments

Comments
 (0)