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:
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
7
libexec/syntax_suggest
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative "../lib/syntax_suggest/api"
|
||||||
|
|
||||||
|
SyntaxSuggest::Cli.new(
|
||||||
|
argv: ARGV
|
||||||
|
).call
|
|
@ -5,8 +5,12 @@ require_relative "../spec_helper"
|
||||||
module SyntaxSuggest
|
module SyntaxSuggest
|
||||||
RSpec.describe "exe" do
|
RSpec.describe "exe" do
|
||||||
def exe_path
|
def exe_path
|
||||||
|
if ruby_core?
|
||||||
|
root_dir.join("../libexec").join("syntax_suggest")
|
||||||
|
else
|
||||||
root_dir.join("exe").join("syntax_suggest")
|
root_dir.join("exe").join("syntax_suggest")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def exe(cmd)
|
def exe(cmd)
|
||||||
out = run!("#{exe_path} #{cmd}", raise_on_nonzero_exit: false)
|
out = run!("#{exe_path} #{cmd}", raise_on_nonzero_exit: false)
|
||||||
|
|
|
@ -43,6 +43,10 @@ def fixtures_dir
|
||||||
spec_dir.join("fixtures")
|
spec_dir.join("fixtures")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ruby_core?
|
||||||
|
!root_dir.join("syntax_suggest.gemspec").exist?
|
||||||
|
end
|
||||||
|
|
||||||
def code_line_array(source)
|
def code_line_array(source)
|
||||||
SyntaxSuggest::CleanDocument.new(source: source).call.lines
|
SyntaxSuggest::CleanDocument.new(source: source).call.lines
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue