-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic tests #180
Comments
What kind of test framework do we want to use?
I am against 2. For 1 and 3 I can send PRs or code very easily. |
@lucc Take a look here: http://stackoverflow.com/questions/971945/unit-testing-for-shell-scripts I don't like having to depend on bash for anything, but I'm leaning towards BATS right now since it seems like the nicest framework. Also depending on bash just for tests doesn't seem like too big a deal. For testing the viml we'd use some vim TAP compatible framework I guess. I think having a test suite in a Other ideas:
|
I had a look at bats and tried to write some tests. The first problem I encountered is that normally you do something like this in bats: @test "-v prints the version of vimpager" {
run standalone/vimpager -v
[[ $status -eq 0 ]]
[[ "$output" = "vimpager*standalone*" ]]
} But that hangs as vimpager just So either we have to redesign vimpager to be testable with bats or we have to hack our way around this problem (I don't know how). Or we have to look for another test framework or write our own. A simple idea for redesigning vimpager would be to wrap most shell code of vimpager into functions, put them all into |
I also had a look at some of the other test suits mentioned in that SO thread.
So here is my opinion:
So after step 2 #!/bin/sh
# Script for using ViM as a PAGER.
# Based on Bram's less.sh.
# git://github.com/rkitover/vimpager.git
# FIND REAL PARENT DIRECTORY
link="$0"
while true; do
ls0="`ls -l \"$link\"`"
new_link="`expr \"$ls0\" : '.* -> \(.*\)$'`"
[ -z "$new_link" ] && break
link="$new_link"
done
project_dir="`dirname \"$link\"`"
# END OF FIND REAL PARENT DIRECTORY
. "$project_dir/inc/prologue.sh"
. "$project_dir/inc/functions.sh"
main "$@"
# Copyright (c) 2016, Rafael Kitover <[email protected]> and
# Contributors (below.)
# ... And we would wrap some code that currently is at the top level of the script into functions. For example a |
As #196 is going to be merged soon (I hope :) I was looking for possibilities to test our vim code. A general discussion on stackoverflow. Here is what test suits and helpers I found so far, I will add more and some comments when I go on evaluating them:
|
We need to start adding some basic tests and having travis run them, stuff gets constantly broken.
Things like, does it build, does the built version run, etc. would be a good start.
The text was updated successfully, but these errors were encountered: