Skip to content

Commit

Permalink
Test(runner.rb)
Browse files Browse the repository at this point in the history
Make it Github Actions raise error if test fail
  • Loading branch information
brianhuster committed Jan 23, 2025
1 parent 4283983 commit 86feafb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

16 changes: 12 additions & 4 deletions tests/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
BASE_INIT_LUA = File.join(ENDWISE_DIR, "tests", "init.lua")
CURSOR = "█"

# global variable
$ok = true

system('cd .. && git clone --depth=1 https://github.com/nvim-treesitter/nvim-treesitter.git && git pull')

def config(opts)
Expand Down Expand Up @@ -45,11 +48,12 @@ def test(description, testcase)
got = File.read(input_fname)
if got != expected
puts ""
STDERR.puts "\e[31mFailed\e[0m: #{description}"
STDERR.puts "\e[34mInput\e[0m:", input.gsub(/\t/, "<tab>")
STDERR.puts "\e[34mGot\e[0m:", got.gsub(/\t/, "<tab>")
STDERR.puts "\e[34mExpected:\e[0m", expected.gsub(/\t/, "<tab>")
puts "\e[31mFailed\e[0m: #{description}"
puts "\e[34mInput\e[0m:", input.gsub(/\t/, "<tab>")
puts "\e[34mGot\e[0m:", got.gsub(/\t/, "<tab>")
puts "\e[34mExpected:\e[0m", expected.gsub(/\t/, "<tab>")
puts "\e[31m======\e[0m"
$ok = false
else
print "\e[32m.\e[0m"
end
Expand All @@ -62,3 +66,7 @@ def test(description, testcase)
end

puts ""

if not $ok
exit 1
end

0 comments on commit 86feafb

Please sign in to comment.