mirror of
https://github.com/chromebrew/chromebrew.git
synced 2026-01-09 07:28:01 -05:00
* 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>
36 lines
857 B
Ruby
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
|