Sha256: f9e4f28d3994f01aed2cf6f5b0856da720be445afae83653cdfd9e51a557b30c

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

require 'test/unit'
require 'como'
include Como
require 'stringio'


# Test execution routine.
def runTest( test )
    Dir.chdir( 'test' )
    FileUtils.mkdir_p "result"
    rf = "result/#{test}.txt"
    gf = "golden/#{test}.txt"

    system( "rm -f #{rf}; touch #{rf}" )

    File.open( "test_#{test}" ).readlines.each do |cmd|
        cmd = cmd.chomp
        next if cmd.empty?
        system( "echo \"---- CMD: #{cmd}\" >> #{rf}" )
        system( "export RUBYLIB=../lib; #{cmd} >> #{rf} 2>&1" )
    end

    new_golden = true
    # Comment the next code line to generate new goldens.
    # WARNING: Only generate new goldens after careful inspection.
    new_golden = false
    
    if new_golden
        # Populate golden files.
        system( "cp #{rf} #{gf}" )
    end

    assert( system( "diff #{rf} #{gf}" ), "FAILED: diff #{rf} #{gf}" )

    Dir.chdir( '..' )
end


class ComoTest < Test::Unit::TestCase

    def test_options()       runTest( "options"       ); end
    def test_queries()       runTest( "queries"       ); end
    def test_config()        runTest( "config"        ); end
    def test_rule_1()        runTest( "rule_1"        ); end
    def test_rule_2()        runTest( "rule_2"        ); end
    def test_subcmd()        runTest( "subcmd"        ); end
    def test_subcmd_rule()   runTest( "subcmd_rule"   ); end
    def test_subcmd_config() runTest( "subcmd_config" ); end
    def test_compatible()    runTest( "compatible"    ); end
    def test_type_prim()     runTest( "type_prim"     ); end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
como-0.2.2 test/test_como.rb
como-0.2.1 test/test_como.rb