#!/usr/bin/ruby # Copyright 2006 by Matt Rogers # Licensed under the GNU LGPL # I don't really care what you do with className = ARGV[0] # Takes a class name as the first and only parameter if className.nil? puts "Need a class name to generate the test. aborting" exit end hBase = "cmake_#{className.downcase}_test.h" cppBase = hBase.gsub(/.h/, ".cpp") mocBase = hBase.gsub(/.h/, ".moc") license = < * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ LICENSE_EOF fileH = < class #{className}Test : public QObject { Q_OBJECT public: #{className}Test() {} virtual ~#{className}Test() {} private slots: void testGoodParse(); void testGoodParse_data(); void testBadParse(); void testBadParse_data(); }; #endif HEADER_EOF fileCpp = <parseFunctionInfo( function ) == true ); delete ast; } void #{className}Test::testGoodParse_data() { } void #{className}Test::testBadParse() { QFETCH( CMakeFunctionDesc, function ); AddExecutableAst* ast = new AddExecutableAst(); QVERIFY( ast->parseFunctionInfo( function ) == false ); delete ast; } void #{className}Test::testBadParse_data() { } #include "#{mocBase}" CPP_EOF puts "Creating test for class #{className}" sourceVar = "#{className.downcase}test_SRCS" targetName = "cmake-#{className.downcase}test" cmakeText = <