1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added syntax_suggest cli and resolve failing exapmle with it

This commit is contained in:
Hiroshi SHIBATA 2022-08-26 11:10:15 +09:00
parent bd1b1eeb0e
commit 8dfc077f70
Notes: git 2022-08-26 12:16:16 +09:00
3 changed files with 16 additions and 1 deletions

7
libexec/syntax_suggest Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require_relative "../lib/syntax_suggest/api"
SyntaxSuggest::Cli.new(
argv: ARGV
).call

View file

@ -5,8 +5,12 @@ require_relative "../spec_helper"
module SyntaxSuggest
RSpec.describe "exe" do
def exe_path
if ruby_core?
root_dir.join("../libexec").join("syntax_suggest")
else
root_dir.join("exe").join("syntax_suggest")
end
end
def exe(cmd)
out = run!("#{exe_path} #{cmd}", raise_on_nonzero_exit: false)

View file

@ -43,6 +43,10 @@ def fixtures_dir
spec_dir.join("fixtures")
end
def ruby_core?
!root_dir.join("syntax_suggest.gemspec").exist?
end
def code_line_array(source)
SyntaxSuggest::CleanDocument.new(source: source).call.lines
end