Skip to content

Commit

Permalink
chore: added bake test task
Browse files Browse the repository at this point in the history
  • Loading branch information
aristotelesbr committed Dec 19, 2023
1 parent ebcfb8d commit f03b200
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bake/test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2023, by Aristóteles Coutinho.

require 'open3'

# Run tests.
#
# @parameter test [String] the path to file
def test(test: nil)
test_dir = 'test'

all_tests_command = "Dir.glob(\"./#{test_dir}/**/test_*.rb\").each { require _1 }"
test_command = test ? "ruby -I#{test_dir} #{test}" : "ruby -I#{test_dir} -e '#{all_tests_command}'"

stdout, _stderr, _status = ::Open3.capture3(test_command)

puts "Output padrão:\n#{stdout}"
end

0 comments on commit f03b200

Please sign in to comment.