2017-12-28 15:35:20 +01:00
|
|
|
/**
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2017, Edouard DUPIN, all right reserved
|
|
|
|
* @license MPL-2 (see license file)
|
|
|
|
*/
|
|
|
|
#include <estyle/estyle.hpp>
|
|
|
|
#include <estyle/Generator.hpp>
|
|
|
|
#include <etk/etk.hpp>
|
|
|
|
#include <etk/os/FSNode.hpp>
|
|
|
|
#include <test-debug/debug.hpp>
|
|
|
|
#include <etest/etest.hpp>
|
|
|
|
|
|
|
|
static etk::String sourceElse1Action = "action_A;if(true){action_K:}else{action_B;}action_D;";
|
|
|
|
static etk::String sourceElse1ActionNoBrace = "action_A;if(true){action_K:}else action_B;action_D;";
|
|
|
|
static etk::String sourceElse2Action = "action_A;if(true){action_K:}else{action_B;action_C;}action_D;";
|
|
|
|
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0000) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else{action_B;}action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1000) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{action_B;\n}action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1010) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{action_B;\n}action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1011) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{ action_B;\n} action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1100) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1101) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
2018-01-01 04:05:20 +01:00
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
|
2017-12-28 15:35:20 +01:00
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1110) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1111) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
2018-01-01 04:05:20 +01:00
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{\n\taction_B;\n}\naction_D;";
|
2017-12-28 15:35:20 +01:00
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_1001) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n{ action_B;\n} action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0100) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else{\n\taction_B;}\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0101) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
2018-01-01 04:05:20 +01:00
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else{\n\taction_B;}\naction_D;";
|
2017-12-28 15:35:20 +01:00
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0110) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else {\n\taction_B; }\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0010) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else {action_B; }action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0011) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else { action_B; } action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0111) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
2018-01-01 04:05:20 +01:00
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else {\n\taction_B; }\naction_D;";
|
2017-12-28 15:35:20 +01:00
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_0001) {
|
2017-12-28 15:35:20 +01:00
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-in-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-in-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-in-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-in-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-before", "true");
|
|
|
|
//interface.properties.set("brace-else-out-new-line-after", "true");
|
|
|
|
//interface.properties.set("brace-else-out-space-before", "true");
|
|
|
|
interface.properties.set("brace-else-out-space-after", "true");
|
|
|
|
//interface.properties.set("brace-else-single", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else{ action_B;} action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-01-01 04:05:20 +01:00
|
|
|
TEST(testElse, brace_else_single_00) {
|
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-single-one-line-size-max", "40");
|
|
|
|
interface.properties.set("brace-else-single", "true");
|
|
|
|
//interface.properties.set("brace-else-single-in-new-line", "true");
|
|
|
|
//interface.properties.set("brace-else-single-in-space", "true");
|
|
|
|
//interface.properties.set("brace-else-single-out-new-line", "true");
|
|
|
|
//interface.properties.set("brace-else-single-out-space", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else action_B;\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(testElse, brace_else_single_10) {
|
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-single-one-line-size-max", "40");
|
|
|
|
interface.properties.set("brace-else-single", "true");
|
|
|
|
interface.properties.set("brace-else-single-in-new-line", "true");
|
|
|
|
//interface.properties.set("brace-else-single-in-space", "true");
|
|
|
|
interface.properties.set("brace-else-single-out-new-line", "true");
|
|
|
|
//interface.properties.set("brace-else-single-out-space", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n\taction_B;\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(testElse, brace_else_single_01) {
|
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-single-one-line-size-max", "40");
|
|
|
|
interface.properties.set("brace-else-single", "true");
|
|
|
|
//interface.properties.set("brace-else-single-in-new-line", "true");
|
|
|
|
interface.properties.set("brace-else-single-in-space", "true");
|
|
|
|
//interface.properties.set("brace-else-single-out-new-line", "true");
|
|
|
|
interface.properties.set("brace-else-single-out-space", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else action_B; action_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
TEST(testElse, brace_else_single_11) {
|
|
|
|
estyle::Generator interface;
|
|
|
|
//interface.properties.set("brace-else-single-one-line-size-max", "40");
|
|
|
|
interface.properties.set("brace-else-single", "true");
|
|
|
|
interface.properties.set("brace-else-single-in-new-line", "true");
|
|
|
|
interface.properties.set("brace-else-single-in-space", "true");
|
|
|
|
interface.properties.set("brace-else-single-out-new-line", "true");
|
|
|
|
interface.properties.set("brace-else-single-out-space", "true");
|
|
|
|
etk::String outputRef = "action_A;\nif (true ){action_K:} else\n\taction_B;\naction_D;";
|
|
|
|
etk::String output = interface.process(sourceElse1Action);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
output = interface.process(sourceElse1ActionNoBrace);
|
|
|
|
EXPECT_EQ(output, outputRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-12-28 15:35:20 +01:00
|
|
|
|
|
|
|
|