Sha256: f594428ccc1e3aadafef3ef0d635a607d08fb5e382712edf8329a32f127638f5
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
# -*- encoding: utf-8 -*- require 'test/unit' require 'helper' require 'webgen/tag' class TestTagExecuteCommand < Test::Unit::TestCase include Test::WebsiteHelper def setup super @obj = Webgen::Tag::ExecuteCommand.new end def call(context, command, process, escape) @obj.set_params({'tag.executecommand.command' => command, 'tag.executecommand.process_output' => process, 'tag.executecommand.escape_html' => escape}) result = @obj.call('execute_cmd', '', context) @obj.set_params({}) [result.first.chomp.strip, result.last] end def test_call root = Webgen::Node.new(Webgen::Tree.new.dummy_root, '/', '/') context = Webgen::Context.new(:chain => [root]) test_text = "a\"b\"" assert_equal([test_text, false], call(context, echo_cmd(test_text), false, false)) assert_equal([test_text, true], call(context, echo_cmd(test_text), true, false)) assert_equal(['a"b"', true], call(context, echo_cmd(test_text), true, true)) assert_equal(['a"b"', true], call(context, echo_cmd(test_text), true, true)) assert_raise(RuntimeError) { call(context, 'invalid_echo_command', true, true) } end def echo_cmd(data) (Config::CONFIG['arch'].include?('mswin32') ? "echo #{data}" : "echo '#{data}'") end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
gettalong-webgen-0.5.8.20090507 | test/test_tag_executecommand.rb |
webgen-0.5.8 | test/test_tag_executecommand.rb |