//--------------------------------------------------------------------------- void FileUtils_T :: init() { TestUtil tester; tempFilePath = tester.getTempPath(); testPrefix = "test_output_fileutils_"; }
//--------------------------------------------------------------------------- void FileHunter_T :: init() { TestUtil tester; tempFilePath = tester.getTempPath() + getFileSep() + "test_output_filehunter"; // create directories and files for the find() tests newDir(tempFilePath); tempFilePath += getFileSep(); // ensure trailling slash newFile(tempFilePath + "sample.data"); newFile(tempFilePath + "prn_08.data"); newFile(tempFilePath + "prn_16.data"); newFile(tempFilePath + "2001_123.data"); newFile(tempFilePath + "2001_234.data"); newFile(tempFilePath + "2002_123.data"); newFile(tempFilePath + "2002_234.data"); newFile(tempFilePath + "2001_123_08.data"); newFile(tempFilePath + "2001_234_08.data"); newFile(tempFilePath + "2002_123_16.data"); newFile(tempFilePath + "2002_234_16.data"); newDir(tempFilePath + "2003"); newDir(tempFilePath + "2004"); newFile(tempFilePath + "2003" + getFileSep() + "123_08.data"); newFile(tempFilePath + "2003" + getFileSep() + "123_16.data"); newFile(tempFilePath + "2003" + getFileSep() + "234_08.data"); newFile(tempFilePath + "2003" + getFileSep() + "234_16.data"); newFile(tempFilePath + "2004" + getFileSep() + "123_08.data"); newFile(tempFilePath + "2004" + getFileSep() + "123_16.data"); newFile(tempFilePath + "2004" + getFileSep() + "234_08.data"); newFile(tempFilePath + "2004" + getFileSep() + "234_16.data"); newFile(tempFilePath + "2003" + getFileSep() + "2003_123.data"); newFile(tempFilePath + "2003" + getFileSep() + "2003_234.data"); newFile(tempFilePath + "2004" + getFileSep() + "2004_123.data"); newFile(tempFilePath + "2004" + getFileSep() + "2004_234.data"); }
void TestInsertTemplate::testInsertTemplateOnClassInjectCode() { const char* cppCode ="struct A{};"; const char* xmlCode = "\ <typesystem package='Foo'>\ <template name='code_template'>\ code template content\ </template>\ <value-type name='A'>\ <inject-code class='native'>\ <insert-template name='code_template'/>\ </inject-code>\ </value-type>\ </typesystem>"; TestUtil t(cppCode, xmlCode, false); AbstractMetaClassList classes = t.builder()->classes(); QCOMPARE(classes.count(), 1); AbstractMetaClass* classA = classes.findClass("A"); QVERIFY(classA); QCOMPARE(classA->typeEntry()->codeSnips().count(), 1); QString code = classA->typeEntry()->codeSnips().first().code(); QVERIFY(code.contains("code template content")); } void TestInsertTemplate::testInsertTemplateOnModuleInjectCode() { const char* cppCode =""; const char* xmlCode = "\ <typesystem package='Foo'>\ <template name='code_template'>\