Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1b2b17e

Browse files
committed
Make the test suite silent
1 parent 09c816c commit 1b2b17e

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

test/ractor_test.rb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,35 @@ def test_formatting
2020
source = SyntaxTree.read(filepath)
2121
program = SyntaxTree.parse(source)
2222

23-
Ractor.new(source, program, name: filepath) do |source, program|
24-
SyntaxTree::Formatter.format(source, program)
23+
with_silenced_warnings do
24+
Ractor.new(source, program, name: filepath) do |source, program|
25+
SyntaxTree::Formatter.format(source, program)
26+
end
2527
end
2628
end
2729

28-
ractors.each(&:take)
30+
ractors.each do |ractor|
31+
assert_kind_of String, ractor.take
32+
end
2933
end
3034

3135
private
3236

3337
def filepaths
3438
Dir.glob(File.expand_path("../lib/syntax_tree/{node,parser}.rb", __dir__))
3539
end
40+
41+
# Ractors still warn about usage, so I'm disabling that warning here just to
42+
# have clean test output.
43+
def with_silenced_warnings
44+
previous = $VERBOSE
45+
46+
begin
47+
$VERBOSE = nil
48+
yield
49+
ensure
50+
$VERBOSE = previous
51+
end
52+
end
3653
end
3754
end

test/rake_test.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ def invoke(task_name)
4646
invocation = nil
4747
stub = ->(args) { invocation = Invocation.new(args) }
4848

49-
begin
49+
assert_raises SystemExit do
5050
SyntaxTree::CLI.stub(:run, stub) { ::Rake::Task[task_name].invoke }
51-
flunk
52-
rescue SystemExit
53-
invocation
5451
end
52+
53+
invocation
5554
end
5655
end
5756
end

0 commit comments

Comments
 (0)