]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/vim-python-pep8-indent/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:

Add '.vim/bundle/black/' from commit '2f3fa1f6d0cbc2a3f31c7440c422da173b068e7b'
[etc/vim.git] / .vim / bundle / vim-python-pep8-indent / spec / spec_helper.rb
1 require 'vimrunner'
2 require 'vimrunner/rspec'
3 require 'vimrunner/server'
4
5 # Explicitly enable usage of "should".
6 RSpec.configure do |config|
7     config.expect_with(:rspec) { |c| c.syntax = :should }
8 end
9
10 Vimrunner::RSpec.configure do |config|
11   # Use a single Vim instance for the test suite. Set to false to use an
12   # instance per test (slower, but can be easier to manage).
13   # This requires using gvim, otherwise it hangs after a few tests.
14   config.reuse_server = ENV['VIMRUNNER_REUSE_SERVER'] == '1' ? true : false
15
16   config.start_vim do
17     exe = config.reuse_server ? Vimrunner::Platform.gvim : Vimrunner::Platform.vim
18     vimrc = File.expand_path("../vimrc", __FILE__)
19     vim = Vimrunner::Server.new(:executable => exe,
20                                 :vimrc => vimrc).start
21     # More friendly killing.
22     # Otherwise profiling information might not be written.
23     def vim.kill
24       normal(':qall!<CR>')
25
26       Timeout.timeout(5) do
27         sleep 0.1 while server.running?
28       end
29     end
30
31     plugin_path = File.expand_path('../..', __FILE__)
32     vim.command "set rtp^=#{plugin_path}"
33     vim.command "set filetype=python"
34
35     def shiftwidth
36       @shiftwidth ||= vim.echo("exists('*shiftwidth') ? shiftwidth() : &sw").to_i
37     end
38     def tabstop
39       @tabstop ||= vim.echo("&tabstop").to_i
40     end
41     def indent
42       vim.echo("indent('.')").to_i
43     end
44     def previous_indent
45       pline = vim.echo("line('.')").to_i - 1
46       vim.echo("indent('#{pline}')").to_i
47     end
48     def proposed_indent
49       line = vim.echo("line('.')")
50       col = vim.echo("col('.')")
51       indent_value = vim.echo("GetPythonPEPIndent(#{line})").to_i
52       vim.command("call cursor(#{line}, #{col})")
53       return indent_value
54     end
55     def multiline_indent(prev, default)
56       i = vim.echo("get(g:, 'python_pep8_indent_multiline_string', 0)").to_i
57       return (i == -2 ? default : i), i < 0 ? (i == -1 ? prev : default) : i
58     end
59     def hang_closing
60       i = vim.echo("get(g:, 'python_pep8_indent_hang_closing', 0)").to_i
61       return (i != 0)
62     end
63     def set_hang_closing(value)
64       i = value ? 1 : 0
65       vim.command("let g:python_pep8_indent_hang_closing=#{i}")
66     end
67
68     vim
69   end
70 end