From 2775d2b664d0930ae128fb36508f65e5eae007f4 Mon Sep 17 00:00:00 2001 From: Ufuk Kayserilioglu Date: Wed, 20 Oct 2021 20:30:17 +0300 Subject: [PATCH] Check test RBI files for well-formedness --- spec/dsl_spec.rb | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index 6babf8f87..face27557 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -91,6 +91,23 @@ def rbi_for(constant_name) file.root.nest_non_public_methods! file.root.group_nodes! file.root.sort_nodes! - file.string + file.string.tap do |str| + output = Tapioca::Compilers::Sorbet.run( + "--no-config", + "--stop-after", + "parser", + "-e", + str, + quiet: false + ) + + assert($?.success?, <<~MSG) # rubocop:disable Style/SpecialGlobalVars + Expected generated RBI file for `#{constant_name}` with no parsing errors. + + Got these parsing errors: + + #{indented(output, 2)} + MSG + end end end