Sha256: d0c6ef2388f28a6b547b0f5821e777d61ce488870026469438fe2da24023f7ce
Contents?: true
Size: 1.47 KB
Versions: 8
Compression:
Stored size: 1.47 KB
Contents
require 'webgen/test' require 'rbconfig' class ExecuteCommandTagTest < Webgen::TagTestCase plugin_files [ 'webgen/plugins/coreplugins/resourcemanager.rb', 'webgen/plugins/tags/executecommand.rb', ] plugin_to_test 'Tag/ExecuteCommand' def test_process_tag testtext = "a\"b\"" set_config( 'command'=>echo_cmd( testtext ), 'processOutput'=>false, 'escapeHTML'=>false ) assert_equal( testtext, @plugin.process_tag( 'executecommand', nil ).chomp.strip ) assert_equal( false, @plugin.process_output? ) set_config( 'command'=>echo_cmd( testtext ), 'processOutput'=>true, 'escapeHTML'=>false ) assert_equal( testtext, @plugin.process_tag( 'executecommand', nil ).chomp.strip ) assert_equal( true, @plugin.process_output? ) set_config( 'command'=>echo_cmd( testtext ), 'processOutput'=>true, 'escapeHTML'=>true ) assert_equal( 'a"b"', @plugin.process_tag( 'executecommand', nil ).chomp.strip ) set_config( 'command'=>echo_cmd( testtext ), 'processOutput'=>true, 'escapeHTML'=>true, 'highlight'=>'ruby' ) assert_kind_of( String, @plugin.process_tag( 'executecommand', nil ) ) set_config( 'command'=>"invalid_echo_command -n '#{testtext}'", 'processOutput'=>true, 'escapeHTML'=>true ) assert_equal( '', @plugin.process_tag( 'executecommand', nil ).chomp.strip ) end def echo_cmd( data ) (Config::CONFIG['arch'].include?( 'mswin32' ) ? "echo #{data}" : "echo '#{data}'") end end
Version data entries
8 entries across 8 versions & 1 rubygems