Module: Cfruby
- Defined in:
- lib/libcfruby/cfruby.rb,
lib/libcfruby/os.rb,
lib/libcfruby/exec.rb,
lib/libcfruby/users.rb,
lib/libcfenjin/parser.rb,
lib/libcfruby/fileops.rb,
lib/libcfruby/checksum.rb,
lib/libcfruby/fileedit.rb,
lib/libcfruby/filefind.rb,
lib/libcfruby/packages.rb,
lib/libcfenjin/cflogger.rb,
lib/libcfenjin/cfp_code.rb,
lib/libcfenjin/cfp_stat.rb,
lib/libcfruby/processes.rb,
lib/libcfruby/scheduler.rb,
lib/libcfenjin/cfp_logger.rb,
lib/libcfenjin/cfp_parser.rb,
lib/libcfenjin/cfp_classes.rb,
lib/libcfenjin/cfp_compile.rb,
lib/libcfenjin/cfp_execute.rb,
lib/libcfenjin/cfp_manager.rb,
lib/libcfruby/cfrubyscript.rb,
lib/libcfenjin/cfp_codetree.rb,
lib/libcfruby/osmodules/osx.rb,
lib/libcfenjin/cfp_liblogger.rb,
lib/libcfenjin/cfp_mapoptions.rb,
lib/libcfenjin/fileeditcached.rb,
lib/libcfenjin/cfp_flowmonitor.rb,
lib/libcfenjin/cfp_parserlogic.rb,
lib/libcfenjin/test/regression.rb,
lib/libcfruby/osmodules/freebsd.rb,
lib/libcfruby/osmodules/openbsd.rb,
lib/libcfenjin/cfp_editfilecached.rb,
lib/libcfruby/osmodules/linux-suse.rb,
lib/libcfruby/osmodules/linux-debian.rb,
lib/libcfruby/osmodules/linux-gentoo.rb,
lib/libcfruby/osmodules/linux-generic.rb
Overview
Regression tester
Defined Under Namespace
Modules: Cfp_ClassAccessor, Cfp_MapOptions, Cfp_ParserLogic, Checksum, Exec, FileEdit, FileFind, FileOps, OS, Packages, Processes, Scheduler, Script, Users Classes: Cfp_Class, Cfp_ClassList, Cfp_Code, Cfp_Codetree, Cfp_Compile, Cfp_EditFileCached, Cfp_Execute, Cfp_ExecuteClass, Cfp_FlowMonitor, Cfp_LibLogger, Cfp_Logger, Cfp_Manager, Cfp_Parser, Cfp_Stat, CfrubyError, CfrubyLogger, FileEditCached, Parser
Constant Summary collapse
- TRACE_ON =
1
- TRACE_LIBRARY =
1
- TRACE_ENGINE =
2
- TRACE_ALL =
3
- LOG_EMERG =
1
- LOG_ALERT =
2
- LOG_CRIT =
3
- LOG_ERR =
4
- LOG_WARNING =
5
- LOG_NOTICE =
6
- LOG_INFO =
7
- LOG_DEBUG =
8
- VERBOSE_MINOR =
3
- VERBOSE_MAJOR =
2
- VERBOSE_CRITICAL =
1
Class Method Summary collapse
- .controller ⇒ Object
-
.regressiontest(text, filename, create = @@test_create) ⇒ Object
Invoke the regression test by passing a string - which ends up a file in test/regression with
filename
. - .regressiontest_create(b) ⇒ Object
-
.regressiontestpath ⇒ Object
Returns location of regression test directory, which is part of the source repository in darcs, so as to retain regression test information.
Class Method Details
.controller ⇒ Object
21 22 23 |
# File 'lib/libcfruby/cfruby.rb', line 21 def Cfruby.controller return(@controller) end |
.regressiontest(text, filename, create = @@test_create) ⇒ Object
Invoke the regression test by passing a string - which ends up a file
in test/regression with +filename+. When +create+ is +true+ the file
will be created/overwritten. Otherwise it is tested against returning
whether it has equal or not. When a test fails both test file and new
file exist in the regrssion directory - so you can execute a diff.
Example:
Cfruby.regressiontest `#{cfrubybin} --help`,'cfruby_helptext',$test_create
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/libcfenjin/test/regression.rb', line 19 def Cfruby.regressiontest text, filename, create = @@test_create testdir = regressiontestpath fn = testdir+'/'+filename+'.rtest' fntest = fn+'.new' if create f = File.open(fn,'w') f.write text File.unlink fntest if File.exist? fntest else # ---- here we have to compare info if ! File.exist?(fn) raise "Cannot execute regression test because file #{fn} does not exist! - use --create option?" end f = File.open(fn) b = '' f.each do | line | b += line end if b!=text # ---- Write newer file f2 = File.open(fntest,'w') f2.write text return false end end true end |
.regressiontest_create(b) ⇒ Object
6 7 8 |
# File 'lib/libcfenjin/test/regression.rb', line 6 def Cfruby.regressiontest_create b @@test_create = b end |
.regressiontestpath ⇒ Object
Returns location of regression test directory, which is part of the source repository in darcs, so as to retain regression test information
51 52 53 |
# File 'lib/libcfenjin/test/regression.rb', line 51 def Cfruby.regressiontestpath File.dirname(__FILE__)+'/../../../test/cfenjin/regression' end |