]> git.madduck.net Git - etc/vim.git/blob - spec/spec_helper.rb

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Improve s:find_start_of_multiline_statement: only look for round parens
[etc/vim.git] / spec / spec_helper.rb
1 require 'vimrunner'
2 require 'vimrunner/rspec'
3
4 # Explicitly enable usage of "should".
5 RSpec.configure do |config|
6     config.expect_with(:rspec) { |c| c.syntax = :should }
7 end
8
9 Vimrunner::RSpec.configure do |config|
10   # Use a single Vim instance for the test suite. Set to false to use an
11   # instance per test (slower, but can be easier to manage).
12   # This requires using gvim, otherwise it hangs after a few tests.
13   config.reuse_server = ENV['VIMRUNNER_REUSE_SERVER'] == '1' ? true : false
14
15   config.start_vim do
16     vim = config.reuse_server ? Vimrunner.start_gvim : Vimrunner.start
17     plugin_path = File.expand_path('../..', __FILE__)
18
19     # add_plugin appends the path to the rtp... :(
20     # vim.add_plugin(plugin_path, 'indent/python.vim')
21
22     vim.command "set rtp^=#{plugin_path}"
23     vim.command "runtime syntax/python.vim"
24     vim.command "runtime indent/python.vim"
25
26     def shiftwidth
27       @shiftwidth ||= vim.echo("exists('*shiftwidth') ? shiftwidth() : &sw").to_i
28     end
29     def tabstop
30       @tabstop ||= vim.echo("&tabstop").to_i
31     end
32     def indent
33       vim.echo("indent('.')").to_i
34     end
35     def previous_indent
36       pline = vim.echo("line('.')").to_i - 1
37       vim.echo("indent('#{pline}')").to_i
38     end
39     def proposed_indent
40       line = vim.echo("line('.')")
41       col = vim.echo("col('.')")
42       indent_value = vim.echo("GetPythonPEPIndent(#{line})").to_i
43       vim.command("call cursor(#{line}, #{col})")
44       return indent_value
45     end
46     def multiline_indent(prev, default)
47       i = vim.echo("get(g:, 'python_pep8_indent_multiline_string', 0)").to_i
48       return (i == -2 ? default : i), i < 0 ? (i == -1 ? prev : default) : i
49     end
50
51     vim
52   end
53 end