Files
chromebrew/tests/commands/whatprovides.rb
Satadru Pramanik, DO, MPH, MEng 34e6887026 Fix regex in crew whatprovides. (#10387)
* Fix regex in crew whatprovides.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add regex test.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-08-31 17:01:55 -05:00

36 lines
857 B
Ruby

require 'minitest/autorun'
require_relative '../../commands/whatprovides'
# Add lib to LOAD_PATH
$LOAD_PATH << File.join(CREW_LIB_PATH, 'lib')
String.use_color = false
class WhatprovidesCommandTest < Minitest::Test
def test_whatprovides
expected_output = <<~TEST_EOF
crew_profile_base: /usr/local/etc/profile
Total found: 1
TEST_EOF
assert_output(expected_output, nil) do
# Command.whatprovides(regex)
Command.whatprovides('/usr/local/etc/profile$')
end
end
end
class WhatprovidesRegexTest < Minitest::Test
def test_whatprovides_regex
expected_output = <<~TEST_EOF
crew_profile_base: /usr/local/etc/bash.d/0-stub
Total found: 1
TEST_EOF
assert_output(expected_output, nil) do
# Command.whatprovides(regex)
Command.whatprovides('bash.d/[0-9]+\-stub$')
end
end
end