File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -142,11 +142,26 @@ def test_generic_error
142142 end
143143 end
144144
145+ def test_plugins
146+ Dir . mktmpdir do |directory |
147+ Dir . mkdir ( File . join ( directory , "syntax_tree" ) )
148+ $:. unshift ( directory )
149+
150+ File . write (
151+ File . join ( directory , "syntax_tree" , "plugin.rb" ) ,
152+ "puts 'Hello, world!'"
153+ )
154+ result = run_cli ( "format" , "--plugins=plugin" )
155+
156+ assert_equal ( "Hello, world!\n test\n " , result . stdio )
157+ end
158+ end
159+
145160 private
146161
147162 Result = Struct . new ( :status , :stdio , :stderr , keyword_init : true )
148163
149- def run_cli ( command , file : nil )
164+ def run_cli ( command , * args , file : nil )
150165 if file . nil?
151166 file = Tempfile . new ( %w[ test- .rb ] )
152167 file . puts ( "test" )
@@ -156,7 +171,7 @@ def run_cli(command, file: nil)
156171
157172 status = nil
158173 stdio , stderr =
159- capture_io { status = SyntaxTree ::CLI . run ( [ command , file . path ] ) }
174+ capture_io { status = SyntaxTree ::CLI . run ( [ command , * args , file . path ] ) }
160175
161176 Result . new ( status : status , stdio : stdio , stderr : stderr )
162177 ensure
You can’t perform that action at this time.
0 commit comments