Skip to content

Commit 8036e2e

Browse files
committed
configure test
1 parent d870f48 commit 8036e2e

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ source "https://rubygems.org"
66
gemspec
77

88
gem "rake", "~> 13.0"
9+
gem "test-unit"
10+
gem "test-unit-ruby-core"

Rakefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
# frozen_string_literal: true
22

33
require "bundler/gem_tasks"
4-
task default: %i[]
4+
require "rake/testtask"
5+
6+
Rake::TestTask.new(:test) do |t|
7+
t.libs << "test"
8+
t.libs << "lib"
9+
t.test_files = FileList["test/repl_completion/test_*.rb"]
10+
end
11+
12+
# To make sure they have been correctly setup for Ruby CI.
13+
desc "Run each repl_completion test file in isolation."
14+
task :test_in_isolation do
15+
failed = false
16+
17+
FileList["test/repl_completion/test_*.rb"].each do |test_file|
18+
ENV["TEST"] = test_file
19+
begin
20+
Rake::Task["test"].execute
21+
rescue => e
22+
failed = true
23+
msg = "Test '#{test_file}' failed when being executed in isolation. Please make sure 'rake test TEST=#{test_file}' passes."
24+
separation_line = '=' * msg.length
25+
26+
puts <<~MSG
27+
#{separation_line}
28+
#{msg}
29+
#{separation_line}
30+
MSG
31+
end
32+
end
33+
34+
fail "Some tests failed when being executed in isolation" if failed
35+
end
36+
37+
task default: %i[test test_in_isolation]

0 commit comments

Comments
 (0)