Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
labels: bug

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If pertinent, add screenshots to help explain your problem.

** Context (please complete the following information):**
- Vim version [e.g. 8.0.1157]
- Other plugins installed

**Additional context**
Add any other context about the problem here.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] ; I'd like to be able to [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
82 changes: 82 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
test:
name: "test on ${{ matrix.os }} ; ${{ matrix.neovim && 'neovim' || 'vim' }}"

strategy:
matrix:
# Testing doesn't seem to work on Windows: output log file
# cannot be read...
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest, macos-latest]
neovim: [false]
# neovim: [false, true]
# TODO: Test different flavours of Vim...

runs-on: ${{ matrix.os }}

env:
CTAGS_VERSION: v6.1.0
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Setup Vim
uses: rhysd/action-setup-vim@v1
# uses: thinca/action-setup-vim@v2
id: vim
with:
neovim: ${{matrix.neovim }}
configure-args: |
--with-features=huge

# Install universal-ctags in cache
- uses: actions/cache@v4
id: cache-ctags
with:
path: $HOME/local
key: ${{ runner.os }}-ctags-${{ env.CTAGS_VERSION }}

# If cache is missed, re-install universal-ctags
- name: Install Universal ctags
if: steps.cache-ctags.outputs.cache-hit != 'true'
run: |
git clone https://github.com/universal-ctags/ctags.git
cd ctags
git checkout tags/$CTAGS_VERSION
builtin type -P brew &> /dev/null && brew install automake
./autogen.sh
./configure --prefix=$HOME/local
make -j 4 install
- name: Add ctags to PATH
run: echo "PATH=$HOME/local/bin:$PATH" >> $GITHUB_ENV

- name: Run tests on Linux
if: runner.os == 'Linux' # headless execution is required on Linux
run: |
bundle list
xvfb-run bundle exec rake ci
- name: Run tests on ${{ matrix.os }}
if: runner.os != 'Linux'
run: |
bundle exec rake ci
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ tags
*.sw*
*~
*.pyc
tests/lh/*.log
*.lock
7 changes: 7 additions & 0 deletions Flavorfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
flavor 'LucHermitte/lh-vim-lib', '>= 5.3.1'
flavor 'LucHermitte/lh-brackets', '>= 3.6.0'
flavor 'LucHermitte/lh-style', '>= 0.9.2'
flavor 'LucHermitte/lh-dev'
flavor 'LucHermitte/mu-template', '>= 4.4.1'
flavor 'LucHermitte/VimFold4C', '>= 3.0.9'
flavor 'LucHermitte/alternate-lite', '>= 0.1.0'
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'rspec', '~> 3.1.0'
gem 'vimrunner', '~> 0.3.1'
gem 'rake', '~> 10.3.2'
gem 'vim-flavor', '~> 2.1.1'
gem 'rspec', '~> 3.13.0'
gem 'vimrunner', '~> 0.3.5'
gem 'rake', '~> 13.0.1'
gem 'vim-flavor', '~> 4.0.3'
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# lh-cpp [![Build Status](https://secure.travis-ci.org/LucHermitte/lh-cpp.png?branch=master)](http://travis-ci.org/LucHermitte/lh-cpp) [![Project Stats](https://www.openhub.net/p/21020/widgets/project_thin_badge.gif)](https://www.openhub.net/p/21020)
# lh-cpp [![Last release][Releases-badge]][Releases-url] [![Build Status][gh-action-badge]][gh-action-result] [![Project Stats][openhub-badge]][openhub-url]

[Releases-badge]: https://img.shields.io/github/tag/LucHermitte/lh-cpp.svg
[Releases-url]: https://github.com/LucHermitte/lh-cpp/tags
[gh-action-badge]: ./../../actions/workflows/tests.yml/badge.svg?branch=master "Test"
[gh-action-result]: ./../../actions/workflows/tests.yml?query=branch%3Amaster
[openhub-badge]: https://www.openhub.net/p/21020/widgets/project_thin_badge.gif
[openhub-url]: https://www.openhub.net/p/21020

## Features

lh-cpp is an heterogeneous suite of helpers for C and C++ programming.
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ task :test => :spec

task :spec do
# 'spec' is implicitly run as well
sh 'rspec ~/.vim-flavor/repos/LucHermitte_vim-UT/spec'
# sh 'rspec --require spec_helper'
sh "bundle exec rspec ~/.vim-flavor/repos/LucHermitte_vim-UT/spec/UT_spec_v2.rb"
end


task :install do
sh 'cat VimFlavor >> tests/VimFlavor'
sh 'cat Flavorfile >> tests/Flavorfile'
sh 'cd tests && bundle exec vim-flavor install'
end
7 changes: 0 additions & 7 deletions VimFlavor

This file was deleted.

4 changes: 2 additions & 2 deletions mkVba/mk-lh-cpp.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
" <URL:http://github.com/LucHermitte/lh-cpp/License.md>
" Version: 2.2.1
" Created: 06th Nov 2007
" Last Update: 28th Nov 2019
" Last Update: 27th Aug 2024
"------------------------------------------------------------------------
let s:version = '2.2.1'
let s:project = 'lh-cpp'
Expand All @@ -21,7 +21,7 @@ finally
let &rtp = save_rtp
endtry
finish
VimFlavor
Flavorfile
addon-info.json
after/plugin/a.vim
after/template/c/assert.template
Expand Down
4 changes: 2 additions & 2 deletions spec/class-with-attributes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

specify "attribute-class copy-neutral, C++98", :cpp98 do
expect(vim.command('call lh#mut#expand_and_jump(0, "cpp/internals/class-skeleton", {"attributes": [{"name": "foo", "type": "int"}, {"name": "str", "type": "string", "functions": ["set", "get"]}, {"name": "bar", "type": "Bar", "includes":"bar.h"}]})')).to match(/^$|#include <string> added/)
vim.feedkeys('\<c-\>\<c-n>:silent! $call append("$", ["",""])\<cr>G')
# vim.feedkeys('\<c-\>\<c-n>:silent! $call append("$", ["",""])\<cr>G')
assert_buffer_contents <<-EOF
/** File Header line to trick auto-inclusion */
#include <string>
Expand Down Expand Up @@ -93,7 +93,7 @@ class «Test»
specify "attribute-class copy-neutral, C++11", :cpp11 do
vim.command('silent! let g:cpp_std_flavour=11')
expect(vim.command('call lh#mut#expand_and_jump(0, "cpp/internals/class-skeleton", {"attributes": [{"name": "foo", "type": "int"}, {"name": "bar", "type": "string", "functions": ["set", "get"]}]})')).to match(/^$|#include <string> added/)
vim.feedkeys('\<c-\>\<c-n>:silent! $call append("$", ["",""])\<cr>G')
# vim.feedkeys('\<c-\>\<c-n>:silent! $call append("$", ["",""])\<cr>G')
assert_buffer_contents <<-EOF
/** File Header line to trick auto-inclusion */
#include <string>
Expand Down
5 changes: 4 additions & 1 deletion spec/constructor-command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
vim.set('ft=cpp')
vim.set('expandtab')
vim.set('sw=4')
vim.set('isk&vim')
vim.command('silent! unlet g:cpp_explicit_default')
vim.command('silent! unlet g:cpp_std_flavour')
vim.command('silent! unlet g:mocked_input')
Expand Down Expand Up @@ -74,9 +75,11 @@ class Foo {
context "when expanding default-constructor", :default_ctr do

it "has a pointer attribute" do # {{{3
pp vim.echo('execute("scriptnames")')
pp vim.echo('execute("set")')
# TODO: In C++11, no need for m_bar() if there is a default
# initialisation at class scope
# expect(vim.echo('lh#dev#class#attributes("Foo")')).to eq('m_bar')
expect(vim.echo('lh#list#get(lh#dev#class#attributes("Foo"), "name")')).to eq("['Foo::m_bar', 'Foo::m_foo']")
# expect(vim.echo('lh#cpp#constructors#debug("s:Attributes(\"Foo\")")')).to eq('m_bar')
# vim.command('Constructor default')
vim.echo('lh#cpp#constructors#Main("default")')
Expand Down
76 changes: 59 additions & 17 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,73 +14,115 @@ def runtime(script)
script_path = Path.new(script)
command("runtime #{script_path}")
end

def append_rtp(dir)
dir_path = Path.new(dir)
if File.directory?(dir.to_s)
append_runtimepath(dir)
else
puts "Path #{dir_path} doesn't exist => ignored"
end
end

def prepend_rtp(dir)
dir_path = Path.new(dir)
if File.directory?(dir.to_s)
prepend_runtimepath(dir)
else
puts "Path #{dir_path} doesn't exist => ignored"
end
end
end
end

module Platform
# For tests use in order of priority:
# 1. gvim -- when available
# 2. vim -- if possible
# nvim is not compatible with vimrunner, let's ignore it now
def best_vim
prefered_vims.find { |vim| suitable?(vim) } or raise NoSuitableVimError
end
private

def prefered_vims
gvims + %w( vim )
end
end

end

Vimrunner::RSpec.configure do |config|
# Use a single Vim instance for the test suite. Set to false to use an
# instance per test (slower, but can be easier to manage).
config.reuse_server = true

vim_plugin_path = File.expand_path('.')
vim_flavor_path = ENV['HOME']+'/.vim/flavors'

config.start_vim do
vim = Vimrunner.start_gvim
# vim = Vimrunner.start
# Use different vimrc in order to see packages installed by vim-flavor
vimrc = File.expand_path('../support/test.vimrc', __FILE__)

# Decide how to start a Vim instance. In this block, an instance
# should be spawned and set up with anything project-specific.
config.start_vim do
vim = Vimrunner::Server.new(:executable => Vimrunner::Platform.best_vim, :vimrc => vimrc).start
vim.add_plugin(vim_flavor_path, 'bootstrap.vim')
vim.prepend_runtimepath(vim_plugin_path+'/after')
vim.prepend_runtimepath(vim_plugin_path)
vim.prepend_rtp(vim_plugin_path)

# lh-UT
vim_UT_path = File.expand_path('../../../vim-UT', __FILE__)
vim.prepend_runtimepath(vim_UT_path)
vim.prepend_rtp(vim_UT_path)
vim.runtime('plugin/UT.vim')

# pp vim_flavor_path
# lh-vim-lib
vim_lib_path = File.expand_path('../../../lh-vim-lib', __FILE__)
vim.prepend_runtimepath(vim_lib_path)
vim.prepend_rtp(vim_lib_path)
vim.runtime('plugin/let.vim') # LetIfUndef
# vim.runtime('plugin/ui-functions.vim') # lh#ui#confirm
# vim.command(':messages')

# lh-tags
vim_tags_path = File.expand_path('../../../lh-tags', __FILE__)
vim.prepend_runtimepath(vim_tags_path)
vim.prepend_rtp(vim_tags_path)
vim.runtime('plugin/lh-tags.vim') # AddStyle

# lh-style
vim_style_path = File.expand_path('../../../lh-style', __FILE__)
vim.prepend_runtimepath(vim_style_path)
vim.prepend_rtp(vim_style_path)
vim.runtime('plugin/lh-style.vim') # AddStyle

# lh-dev
vim_dev_path = File.expand_path('../../../lh-dev', __FILE__)
vim.prepend_runtimepath(vim_dev_path)
vim.prepend_rtp(vim_dev_path)

# lh-brackets
vim_brackets_path = File.expand_path('../../../lh-brackets', __FILE__)
vim.prepend_runtimepath(vim_brackets_path)
vim.prepend_rtp(vim_brackets_path)
vim.runtime('plugin/misc_map.vim') # Inoreab
vim.runtime('plugin/common_brackets.vim') # Brackets
vim.runtime('plugin/bracketing.base.vim') # !mark!
vim.runtime('plugin/bracketing.base.vim') # !mark!, !jump!
vim.command('set enc=utf-8')
#vim.command('SetMarker <+ +>')

# mu-template
mu_template_path = File.expand_path('../../../mu-template@lh', __FILE__)
vim.prepend_runtimepath(mu_template_path+'/after')
vim.prepend_runtimepath(mu_template_path)
vim.runtime('plugin/mu-template.vim') # !mark!
vim.append_rtp(mu_template_path+'/after')
vim.prepend_rtp(mu_template_path)
vim.runtime('plugin/mu-template.vim')
vim.append_rtp(vim_plugin_path+'/after')

# pp vim.echo('&rtp')
pp vim.echo('"RTP -> " . &rtp')
vim.command('set shm=')

has_redo = vim.echo('has("patch-7.4.849")')
if has_redo != "1"
puts "WARNING: this flavor of vim won't permit to support redo"
end

pp vim.echo('"mut-dir -> " . string(lh#mut#dirs#update())')

# The returned value is the Client available in the tests.
vim
end
end
Expand Down
12 changes: 12 additions & 0 deletions spec/support/test.vimrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
" Special vimrc to used instead of vimrunner vimrc which disable all plugins
" It should automatically load plugins installed as packages by vim-flavor
set nocompatible

filetype plugin on
filetype indent on
syntax on

set rtp-=~/.vim
set rtp-=~/.vim/after
set noswapfile nobackup
set loadplugins
Loading
Loading