Sha256: 908899d75dd82a1afada382e2530f5bf0f387ffebec7ac630abe84ba7d1e54e4
Contents?: true
Size: 1.23 KB
Versions: 3
Compression:
Stored size: 1.23 KB
Contents
# -*- encoding: utf-8 -*- require 'webgen/test_helper' require 'webgen/tag/execute_command' require 'time' class TestTagExecuteCommand < MiniTest::Unit::TestCase include Webgen::TestHelper def test_call setup_context test_text = "a\"b\"" assert_tag_result([test_text, false], echo_cmd(test_text), false, false) assert_tag_result([test_text, true], echo_cmd(test_text), true, false) assert_tag_result(['a"b"', true], echo_cmd(test_text), true, true) assert_tag_result(['a"b"', true], echo_cmd(test_text), true, true) @context[:config]['tag.execute_command.command'] = 'invalid_echo_command' assert_raises(Webgen::RenderError) { Webgen::Tag::ExecuteCommand.call('execute_cmd', '', @context) } end def assert_tag_result(result, command, process, escape) @context[:config] = {'tag.execute_command.command' => command, 'tag.execute_command.process_output' => process, 'tag.execute_command.escape_html' => escape} retval = Webgen::Tag::ExecuteCommand.call('execute_cmd', '', @context) assert_equal(result, [retval.first.chomp.strip, retval.last]) end def echo_cmd(data) (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? "echo #{data}" : "echo '#{data}'") end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
webgen-1.0.0.beta3 | test/webgen/tag/test_execute_command.rb |
webgen-1.0.0.beta2 | test/webgen/tag/test_execute_command.rb |
webgen-1.0.0.beta1 | test/webgen/tag/test_execute_command.rb |