Skip to content
Merged
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
30 changes: 28 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
sudo: required
dist: trusty

install:
- sudo make install-deb
# Update to a new version of lintian as the one on trusty is quite old.
# This also runs apt-get update.
- scripts/update_lintian
script: lintian --profile debian -i --fail-on-warnings -EvIL +pedantic ../vimpager*.changes
# Install the test suite manually as there is no package for it on trusty.
- ( git clone https://github.com/sstephenson/bats.git && cd bats && ./install.sh ~/.local )

before_script:
# The version output of vimpager depends of the tags in the repository so
# we need to fetch them before running the tests. Currently all tags are
# fetched. TODO: Only fetch the latest tag.
- git fetch --unshallow --tags
# The bats directory is only needed during the manual installation above.
# It would be reported by lintian otherwise.
- rm -fr bats


script:
# The target install-deb also installs the sharutils package that contains
# uuencode. Without DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage (which is
# run by install-deb) would also run the tests.
- sudo make install-deb CLEAN_BUILD_DEPS=0 DEB_BUILD_OPTIONS=nocheck
# lintian has to be run after make install-deb as it needs the file that
# are created by the makefile.
- lintian --profile debian -i --fail-on-warnings -EvIL +pedantic ../vimpager*.changes
- make all
- make test

# vim: sw=4
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ install-deb:
echo >&2; \
exit 1; \
fi
@apt-get update || true
@apt-get -y install debhelper devscripts equivs gdebi-core
@-apt-get -qq update
@apt-get -yqq install debhelper devscripts equivs gdebi-core
@mk-build-deps
@echo y | gdebi vimpager-build-deps*.deb
@rm -f vimpager-build-deps*.deb
Expand All @@ -210,7 +210,7 @@ install-deb:
@dpkg-buildpackage -us -uc
@echo y | gdebi `ls -1t ../vimpager*deb | head -1`
@dpkg --purge vimpager-build-deps
@[ "$${CLEAN_BUILD_DEPS:-1}" -ne 0 ] && apt-get -y autoremove || true
@-[ "$${CLEAN_BUILD_DEPS:-1}" -ne 0 ] && apt-get -yqq autoremove
@debian/rules clean

docs: ${GEN_DOCS} docs.tar.gz Makefile
Expand Down Expand Up @@ -279,6 +279,8 @@ html/%.html: %.md.work
realclean distclean clean:
rm -rf *.work */*.work *-stamp *-version.txt *.deb *.tar.gz *.configured *.uu */*.uu man html standalone */with_meta_*

.PHONY: all install install-deb uninstall docs realclean distclean clean
test: standalone/vimpager standalone/vimcat
bats test

.PHONY: all install install-deb uninstall docs realclean distclean clean test
# vim: sw=4
2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Upstream-Name: vimpager
Upstream-Contact: Rafael Kitover <rkitover@gmail.com>
Source: http://github.com/rkitover/vimpager

Files: vimpager vimcat vimpagerrc *.yml .travis.yml Makefile markdown_src/*.md markdown/*.md autoload/vimpager.vim autoload/vimpager_utils.vim plugin/vimpager.vim prototypes/* prototypes/*/* scripts/* inc/*
Files: vimpager vimcat vimpagerrc *.yml .travis.yml Makefile markdown_src/*.md markdown/*.md autoload/vimpager.vim autoload/vimpager_utils.vim plugin/vimpager.vim prototypes/* prototypes/*/* scripts/* inc/* test/*
Copyright: 2016 Rafael Kitover <rkitover@gmail.com>
License: BSD-2-Clause

Expand Down
6 changes: 3 additions & 3 deletions scripts/update_lintian
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/bin/sh

sudo apt-get update || true
sudo apt-get -y install debian-archive-keyring
sudo apt-get -yqq update
sudo apt-get -yqq install debian-archive-keyring
sudo sh -c "echo 'deb-src http://httpredir.debian.org/debian unstable main' > /etc/apt/sources.list.d/debian-src.list"
sudo apt-get update || true
sudo apt-get -qq update

export DEB_BUILD_OPTIONS=nocheck

Expand Down
22 changes: 22 additions & 0 deletions test/find-sourced-files-with-symlinks-to-script.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bats

load helpers

teardown () {
rm -f output.*
}

@test "symlink to vimpager finds the correct project directory" {
script -q -e -c "$fixtures/bin/vimpager-relative-symlink-to-git -v" output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimpager.*\(git\) ]]
}
@test "symlink to vimcat finds the correct project directory" {
script -q -e -c "$fixtures/bin/vimcat-relative-symlink-to-git -v" output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimcat.*\(git\) ]]
}

# vim: filetype=sh
1 change: 1 addition & 0 deletions test/fixtures/bin/vimcat-relative-symlink-to-git
1 change: 1 addition & 0 deletions test/fixtures/bin/vimpager-relative-symlink-to-git
21 changes: 21 additions & 0 deletions test/fixtures/vimcat-help.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Usage: vimcat [OPTION]... [FILE | -]...
Display FILE(s) in the terminal with vim syntax highlighting using ANSI escape codes.

With no FILE, or when FILE is -, read standard input.

-h, --help, --usage This help screen.
-v, --version Show version information and exit.
-n Print with line numbers.
-s Squeeze multiple blank lines into one.
-o FILE | - Output ANSI highlighted text to FILE or standard output.
--cmd COMMAND Run vim COMMAND before initialization.
-c COMMAND Run vim COMMAND after initialization.
-u FILE Use FILE as the vimrc.
-x  Give debugging output on stderr.

Examples:
vimcat program.py # output program.py with highlighting to terminal

Project homepage: <http://github.com/rkitover/vimpager>
and documentation: <https://github.com/rkitover/vimpager/blob/master/markdown/vimcat.md>
or available locally via: man vimcat
22 changes: 22 additions & 0 deletions test/fixtures/vimpager-help.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Usage: vimpager [OPTION]... [FILE | -]...
Display FILE(s) in vim with a pager emulating less.

With no FILE, or when FILE is -, read standard input.

-h, --help, --usage Show this help screen and exit.
-v, --version Show version information and exit.
+G, + Go to the end of the file.
-N, --LINE-NUMBERS Show line numbers.
-s Squeeze multiple blank lines into one.
--cmd COMMAND Run vim COMMAND before initialization.
-c COMMAND Run vim COMMAND after initialization.
-u FILE Use FILE as the vimrc.
-x  Give debugging output on stderr.

Examples:
vimpager program.py # view program.py in the pager
PAGER=vimpager man 3 sprintf # view man page for sprintf(3)

Project homepage and documentation: <http://github.com/rkitover/vimpager>
or available locally via: man vimpager
Press ',h' for a summary of keystrokes in the program.
62 changes: 62 additions & 0 deletions test/help-and-version-output.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bats

load helpers

teardown () {
rm -f output.*
}

@test "vimpager help output of the git version" {
script -q -e -c './vimpager -h' output.1
sed 1d output.1 > output.2
run diff output.2 "$fixtures/vimpager-help.txt"
status_ok
no_output
}
@test "vimpager help output of the standalone version" {
script -q -e -c './standalone/vimpager -h' output.1
sed 1d output.1 > output.2
run diff output.2 "$fixtures/vimpager-help.txt"
status_ok
no_output
}
@test "vimpager version output of the git version" {
script -q -e -c './vimpager -v' output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimpager.*\(git\) ]]
}
@test "vimpager version output of the standalone version" {
script -q -e -c './standalone/vimpager -v' output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimpager.*\(standalone,\ shell=.*\) ]]
}
@test "vimcat help output of the git version" {
script -q -e -c './vimcat -h' output.1
sed 1d output.1 > output.2
run diff output.2 "$fixtures/vimcat-help.txt"
status_ok
no_output
}
@test "vimcat help output of the standalone version" {
script -q -e -c './standalone/vimcat -h' output.1
sed 1d output.1 > output.2
run diff output.2 "$fixtures/vimcat-help.txt"
status_ok
no_output
}
@test "vimcat version output of the git version" {
script -q -e -c './vimcat -v' output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimcat.*\(git\) ]]
}
@test "vimcat version output of the standalone version" {
script -q -e -c './standalone/vimcat -v' output.1
run sed 1d output.1
status_ok
[[ "$output" =~ vimcat.*\(standalone,\ shell=.*\) ]]
}

# vim: filetype=sh
9 changes: 9 additions & 0 deletions test/helpers.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!bash

fixtures=$BATS_TEST_DIRNAME/fixtures
status_ok () {
[ "$status" -eq 0 ]
}
no_output () {
[ -z "$output" ]
}