diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | bcb704366cb5e333a626c18c308c7e0448a8e69f (patch) | |
tree | f0d6ab7d78ecdd9207cf46536376b44b91a1ca71 /kopete/libkopete/tests/create_test.rb | |
download | tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.tar.gz tdenetwork-bcb704366cb5e333a626c18c308c7e0448a8e69f.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/tests/create_test.rb')
-rwxr-xr-x | kopete/libkopete/tests/create_test.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/kopete/libkopete/tests/create_test.rb b/kopete/libkopete/tests/create_test.rb new file mode 100755 index 00000000..7951bf35 --- /dev/null +++ b/kopete/libkopete/tests/create_test.rb @@ -0,0 +1,56 @@ +#!/usr/bin/ruby +# +# Copyright (c) 2005 by Duncan Mac-Vicar <[email protected]> +# +# Kopete (c) 2002-2005 by the Kopete developers <[email protected]> +# +# ************************************************************************* +# * * +# * 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. * +# * * +# ************************************************************************* + +className = ARGV[0] + +if className.nil? + puts "Need a class name" + exit +end + +puts "Creating test for class #{className}" + +hBase = "template_test.h" +cppBase = "template_test.cpp" + +fileH = File.new(hBase).read +fileCpp = File.new(cppBase).read + +fileH.gsub!(/TEMPLATE/, className.upcase.gsub(/::/,"")) +fileH.gsub!(/Template/, className.gsub(/::/,"")) +fileH.gsub!(/some requirement/, className + " class.") + +fileCpp.gsub!(/TEMPLATE/, className.upcase.gsub(/::/,"")) +fileCpp.gsub!(/template/, className.downcase.gsub(/::/,"")) +fileCpp.gsub!(/Template/, className.gsub(/::/,"")) +fileCpp.gsub!(/some requirement/, className + " class.") + +makefileAm = "kunittest_template_test_la_SOURCES = template_test.cpp\nkunittest_template_test_la_LIBADD = -lkunittest ../mock/libkopete_mock.la\nkunittest_template_test_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN) $(all_libraries)\n" +makefileAm.gsub!(/template/, className.downcase.gsub(/::/,"")) + +hNew = hBase.gsub(/template/, className.downcase.gsub(/::/,"")) +cppNew = cppBase.gsub(/template/, className.downcase.gsub(/::/,"")) + +hOut = File.new(hNew, "w") +cppOut = File.new(cppNew, "w") + +hOut.write(fileH) +cppOut.write(fileCpp) + +puts "#{hNew} and #{cppNew} writen." + +puts "Please add the following to Makefile.am:" +puts makefileAm + |