[DEV] start add generation of struct and class

This commit is contained in:
Edouard DUPIN 2018-01-03 22:31:45 +01:00
parent 210a42e5cb
commit f8f7128c78
4 changed files with 538 additions and 7 deletions

View File

@ -904,16 +904,33 @@ int32_t estyle::Generator::process(int32_t _startId,
typePop();
continue;
}
if (elem == estyle::lexer::RESERVED_NAMESPACE) {
if ( elem == estyle::lexer::RESERVED_NAMESPACE
|| elem == estyle::lexer::RESERVED_CLASS
|| elem == estyle::lexer::RESERVED_STRUCT) {
addNewLineIfSemiColon();
typePush("namespace");
addSpaceIfNeeded();
m_output += "namespace";
if (elem == estyle::lexer::RESERVED_NAMESPACE) {
typePush("namespace");
m_output += "namespace";
} else if (elem == estyle::lexer::RESERVED_CLASS) {
typePush("class");
m_output += "class";
} else if (elem == estyle::lexer::RESERVED_STRUCT) {
typePush("struct");
m_output += "struct";
} else {
if (startWithText(m_lexer.getData(iii)) == true) {
addSpaceIfNeeded();
}
m_output += m_lexer.getData(iii);
continue;
}
// special case ==> nothing special to do for the else element...
if (nextIs(iii+1, estyle::lexer::BRACE_IN) == false) {
if (nextIs(iii+1, estyle::lexer::ID) == true) {
// normal case ==> empty namespace
addSpace();
// normal case ==> empty namespace / struct / class
addSpaceIfNeeded();
iii++;
m_output += m_lexer.getData(iii);
} else {
@ -935,7 +952,7 @@ int32_t estyle::Generator::process(int32_t _startId,
subGenerationStart = iii+2;
subGenerationStop = endOfSection(iii+1);
} else {
ESTYLE_ERROR("Missing { in namespace");
ESTYLE_ERROR("Missing { in " << elem);
typePop();
continue;
}

View File

@ -0,0 +1,257 @@
/**
* @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 source = "action_A;class MyClass{action_B;}action_D;";
TEST(testClass, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass{action_B;}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{action_B;\n}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{action_B;\n}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{ action_B;\n} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass\n{ action_B;\n} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass{\n\taction_B;}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass{\n\taction_B;}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass {\n\taction_B; }\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
//interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
//interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass {action_B; }action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass { action_B; } action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
interface.properties.set("brace-class-in-new-line-after", "true");
interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
interface.properties.set("brace-class-out-new-line-after", "true");
interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass {\n\taction_B; }\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testClass, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-class-in-new-line-before", "true");
//interface.properties.set("brace-class-in-new-line-after", "true");
//interface.properties.set("brace-class-in-space-before", "true");
interface.properties.set("brace-class-in-space-after", "true");
//interface.properties.set("brace-class-out-new-line-before", "true");
//interface.properties.set("brace-class-out-new-line-after", "true");
//interface.properties.set("brace-class-out-space-before", "true");
interface.properties.set("brace-class-out-space-after", "true");
etk::String outRef = "action_A;class MyClass{ action_B;} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}

View File

@ -0,0 +1,257 @@
/**
* @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 source = "action_A;struct MyStruct{action_B;}action_D;";
TEST(testStruct, brace_0000) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct{action_B;}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1000) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{action_B;\n}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1010) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{action_B;\n}action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1011) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{ action_B;\n} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1100) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1101) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1110) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1111) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{\n\taction_B;\n}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_1001) {
estyle::Generator interface;
interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct\n{ action_B;\n} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0100) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct{\n\taction_B;}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0101) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct{\n\taction_B;}\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0110) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct {\n\taction_B; }\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0010) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
//interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
//interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct {action_B; }action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0011) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct { action_B; } action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0111) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
interface.properties.set("brace-struct-in-new-line-after", "true");
interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
interface.properties.set("brace-struct-out-new-line-after", "true");
interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct {\n\taction_B; }\naction_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}
TEST(testStruct, brace_0001) {
estyle::Generator interface;
//interface.properties.set("brace-struct-in-new-line-before", "true");
//interface.properties.set("brace-struct-in-new-line-after", "true");
//interface.properties.set("brace-struct-in-space-before", "true");
interface.properties.set("brace-struct-in-space-after", "true");
//interface.properties.set("brace-struct-out-new-line-before", "true");
//interface.properties.set("brace-struct-out-new-line-after", "true");
//interface.properties.set("brace-struct-out-space-before", "true");
interface.properties.set("brace-struct-out-space-after", "true");
etk::String outRef = "action_A;struct MyStruct{ action_B;} action_D;";
etk::String output = interface.process(source);
EXPECT_EQ(output, outRef);
}

View File

@ -436,7 +436,7 @@ TEST(testWhile, condition_1) {
EXPECT_EQ(output, outRef);
interface.properties.set("condition-while-multi-line-big-size", "20");
output = interface.process(base);
outRef = "action_A;while ( condition<6\n && my_stupid_variable==77 ){action_B;}action_D;";
outRef = "action_A;while( condition<6\n && my_stupid_variable==77){action_B;}action_D;";
EXPECT_EQ(output, outRef);
}