If test
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile
--- branches/xmlbuildsystem/reactos/tools/rbuild/makefile
2005-01-15 16:42:28 UTC (rev 13060)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile
2005-01-15 17:59:06 UTC (rev 13061)
@@ -27,6 +27,7 @@
TESTS = \
tests/definetest.o \
+ tests/iftest.o \
tests/includetest.o \
tests/invoketest.o \
tests/linkerflagtest.o \
_____
Modified: branches/xmlbuildsystem/reactos/tools/rbuild/test.h
--- branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-15
16:42:28 UTC (rev 13060)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/test.h 2005-01-15
17:59:06 UTC (rev 13061)
@@ -81,10 +81,18 @@
void Run();
};
+
class LinkerFlagTest : public BaseTest
{
public:
void Run();
};
+
+class IfTest : public BaseTest
+{
+public:
+ void Run();
+};
+
#endif /* __TEST_H */
_____
Modified:
branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
2005-01-15 16:42:28 UTC (rev 13060)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/alltests.cpp
2005-01-15 17:59:06 UTC (rev 13061)
@@ -175,6 +175,7 @@
tests.push_back(new IncludeTest());
tests.push_back(new InvokeTest());
tests.push_back(new LinkerFlagTest());
+ tests.push_back(new IfTest());
}
};
_____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml
2005-01-15 16:42:28 UTC (rev 13060)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/if.xml
2005-01-15 17:59:06 UTC (rev 13061)
@@ -0,0 +1,9 @@
+<?xml version="1.0" ?>
+<project name="Project" makefile="Makefile">
+ <module name="module1" type="buildtool">
+ <if property="VAR1" value="value1">
+ <file>file1.c</file>
+ </if>
+ <file>file2.c</file>
+ </module>
+</project>
_____
Added: branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp
--- branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp
2005-01-15 16:42:28 UTC (rev 13060)
+++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/iftest.cpp
2005-01-15 17:59:06 UTC (rev 13061)
@@ -0,0 +1,25 @@
+#include "test.h"
+
+using std::string;
+
+void IfTest::Run()
+{
+ string projectFilename ( "tests/data/if.xml" );
+ Project project ( projectFilename );
+
+ ARE_EQUAL ( 1, project.modules.size () );
+ Module& module1 = *project.modules[0];
+
+ ARE_EQUAL ( 1, module1.ifs.size () );
+ If& if1 = *module1.ifs[0];
+ ARE_EQUAL ( "VAR1", if1.property );
+ ARE_EQUAL ( "value1", if1.value );
+
+ ARE_EQUAL ( 1, if1.files.size () );
+ File& file1 = *if1.files[0];
+ ARE_EQUAL( "." SSEP "file1.c", file1.name );
+
+ ARE_EQUAL ( 1, module1.files.size () );
+ File& file2 = *module1.files[0];
+ ARE_EQUAL( "." SSEP "file2.c", file2.name );
+}