aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/share/nvim/site/test/helper.rb
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-03-31 17:52:49 +0300
committerYaroslav <contact@yaroslavps.com>2020-03-31 17:52:49 +0300
commit7217c7749e5403c9c7856c1d12c7986eb9c3b460 (patch)
treed60a112d9119a51af1cf5f590c5efad81751edf6 /dotfiles/.local/share/nvim/site/test/helper.rb
parent9a3aa7b20a67c1b7991da1da9508ad5f78f76352 (diff)
downloadvimrice-7217c7749e5403c9c7856c1d12c7986eb9c3b460.tar.gz
vimrice-7217c7749e5403c9c7856c1d12c7986eb9c3b460.zip
Goodbye vim, been using neovim for ages now; home directory cleanup
Diffstat (limited to 'dotfiles/.local/share/nvim/site/test/helper.rb')
-rw-r--r--dotfiles/.local/share/nvim/site/test/helper.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/dotfiles/.local/share/nvim/site/test/helper.rb b/dotfiles/.local/share/nvim/site/test/helper.rb
new file mode 100644
index 0000000..5c50977
--- /dev/null
+++ b/dotfiles/.local/share/nvim/site/test/helper.rb
@@ -0,0 +1,54 @@
+require "minitest/autorun"
+require "vimrunner"
+require "fileutils"
+require "tempfile"
+
+MiniTest::Unit::TestCase.define_singleton_method(:test_order) do :alpha end
+
+begin
+ require "minitest/reporters"
+ MiniTest::Reporters.use! MiniTest::Reporters::SpecReporter.new
+rescue LoadError
+end
+
+$vimrc = File.expand_path("../vimrc", __FILE__)
+$vim = Vimrunner::Server.new(:vimrc => $vimrc).start
+Minitest::Unit.after_tests { $vim.kill }
+
+module WithTemporaryDirectory
+ def self.included(base)
+ require "tmpdir"
+ end
+
+ def setup
+ super
+ # Mac has the temporary directory symlinked, so need File.realpath to
+ # match the paths that Vim returns.
+ @dir = File.realpath(Dir.mktmpdir)
+ end
+
+ def teardown
+ FileUtils.remove_entry_secure @dir
+ super
+ end
+end
+
+def touch(path, contents = nil)
+ FileUtils.mkpath File.dirname(path)
+
+ if contents.nil? || contents.empty?
+ FileUtils.touch(path)
+ else
+ File.open(path, "w") {|f| f.write contents }
+ end
+
+ path
+end
+
+CORE_MODULES = %w[_debugger _http_agent _http_client _http_common
+ _http_incoming _http_outgoing _http_server _linklist _stream_duplex
+ _stream_passthrough _stream_readable _stream_transform _stream_writable
+ _tls_legacy _tls_wrap assert buffer child_process cluster console
+ constants crypto dgram dns domain events freelist fs http https module
+ net node os path punycode querystring readline repl smalloc stream
+ string_decoder sys timers tls tty url util vm zlib]