module L::Test

Testing.

This testing is powered by Minitest. Look up the docs for that.

All test are defined as regular Minitest tests and they will be automatically picked up and have tags created for them.

When defining the test class there will be an additional method {Minitest::Runnable#rub_add_dependency} that will allow the test to depend on any target. Therefore you can ensure that what you are testing has been built.

@example Defining dependencies.

Minitest::Test
    rub_add_dependancy $myexe # Ensure $myexe will be available when test are run.

    def test_help
            c = R::Command.new [$myexe, '--help']
            c.run

            assert c.success?, 'Help exited with a good status code'
    end
end

Public Class Methods

external(cmd, name) click to toggle source
# File lib/rub/l/test.rb, line 249
def self.external(cmd, name)
        t = TargetTestExecutable.new
        t.add_cmd cmd
        t.output << name
        
        t.register
end
make_test(klass) click to toggle source
# File lib/rub/l/test.rb, line 94
def self.make_test(klass)
        @tests ||= {}

        sklass = klass.to_s
        if sklass =~ /^Test/ 
                name = sklass
                         .gsub(/(?<=[a-z0-9])([A-Z])/, '-\1')
                         .gsub(/(?<=[^0-9])([0-9])/, '-\1')
                         .gsub('_', '-')
                         .downcase.to_sym
                #pp name
                
                @tests[name] ||= TargetTestCase.new(klass, name)
        end
end