bsdcontrol.rb/test/readme_examples_test.rb

27 lines
647 B
Ruby
Raw Normal View History

2024-05-12 05:59:38 +02:00
# frozen_string_literal: true
2024-05-12 05:53:21 +02:00
require_relative "setup"
class ReadmeExamplesTest < Test::Unit::TestCase
require "rbconfig"
require "test/cmd"
2024-05-12 06:32:20 +02:00
def test_available_features_success
assert_equal true,
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
.status.success?
end
def test_available_features_stdout
cmd(RbConfig.ruby, readme_example("1_available_features.rb"))
.stdout
.each_line { assert_match %r{The [a-zA-Z0-9_]+ feature is available}, _1 }
2024-05-12 05:53:21 +02:00
end
private
def readme_example(name)
2024-05-12 05:59:38 +02:00
File.join(Dir.getwd, "share", "bsdcontrol.rb", "examples", name)
2024-05-12 05:53:21 +02:00
end
end