From 38062b391f8d4435ff92a6a6e2e38748b5a9cb8d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 8 Mar 2023 20:40:06 +0900 Subject: [PATCH 1/4] Disable color mode of test-syntax-suggest when on dumb terminal The compliation-mode of Emacs sets TERM to "dumb" and does not support coloring. --- spec/spec_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 67d4018..8691246 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -16,6 +16,12 @@ config.expect_with :rspec do |c| c.syntax = :expect end + + if config.color_mode == :automatic + if color_enabled? and (ENV["TERM"] == "dumb" or ENV["NO_COLOR"]&.slice(0)) + config.color_mode = :off + end + end end # Used for debugging modifications to From 0f795e7746e54e44dfa0cc783e40932d1061466d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 9 Mar 2023 00:49:11 +0900 Subject: [PATCH 2/4] Fix commit miss --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8691246..ab5d153 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ end if config.color_mode == :automatic - if color_enabled? and (ENV["TERM"] == "dumb" or ENV["NO_COLOR"]&.slice(0)) + if config.color_enabled? and (ENV["TERM"] == "dumb" or ENV["NO_COLOR"]&.slice(0)) config.color_mode = :off end end From a9cda1a012b95fdbb1b76ed6fc6de5bd81d25712 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 6 Apr 2023 16:15:41 +0900 Subject: [PATCH 3/4] Load only SyntaxSuggest::VERSION for version check --- spec/integration/ruby_command_line_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/ruby_command_line_spec.rb b/spec/integration/ruby_command_line_spec.rb index e7523ee..b41a4c8 100644 --- a/spec/integration/ruby_command_line_spec.rb +++ b/spec/integration/ruby_command_line_spec.rb @@ -58,7 +58,7 @@ module SyntaxSuggest EOM script.write(contents) - out = `#{ruby} -I#{lib_dir} -rsyntax_suggest #{script} 2>&1` + out = `#{ruby} -I#{lib_dir} -rsyntax_suggest/version #{script} 2>&1` expect(out).to include("suggest_version is #{SyntaxSuggest::VERSION}").once end From 6e266b3b2be7492e27ed1dea9864ba244dc75e96 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 6 Apr 2023 16:42:56 +0900 Subject: [PATCH 4/4] standardrb --fix-unsafely spec/spec_helper.rb --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ab5d153..89bc9f4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -18,7 +18,7 @@ end if config.color_mode == :automatic - if config.color_enabled? and (ENV["TERM"] == "dumb" or ENV["NO_COLOR"]&.slice(0)) + if config.color_enabled? && ((ENV["TERM"] == "dumb") || ENV["NO_COLOR"]&.slice(0)) config.color_mode = :off end end