regressiontest 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +23 -2
- data/VERSION +1 -1
- data/lib/regressiontest/cli_exec.rb +31 -7
- metadata +17 -17
data/README.md
CHANGED
@@ -2,9 +2,16 @@
|
|
2
2
|
|
3
3
|
[](http://travis-ci.org/pjotrp/regressiontest)
|
4
4
|
|
5
|
-
|
5
|
+
regressiontest, at this point, is a simple module for calling programs
|
6
|
+
on the command line, capturing output and comparing output against an
|
7
|
+
existing reference file. The idea is to capture changes in output at a
|
8
|
+
very global level, perhaps with different input files and command line
|
9
|
+
options.
|
6
10
|
|
7
|
-
Note
|
11
|
+
Note that JRuby on Travis does not allow invoking the command line,
|
12
|
+
but MRI and Rubinius work fine.
|
13
|
+
|
14
|
+
Note: this software is under active development, your mileage may vary!
|
8
15
|
|
9
16
|
## Installation
|
10
17
|
|
@@ -18,6 +25,20 @@ Note: this software is under active development!
|
|
18
25
|
require 'regressiontest'
|
19
26
|
```
|
20
27
|
|
28
|
+
Simple usage
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
RegressionTest::CliExec::exec("ls","-l").should be_true
|
32
|
+
```
|
33
|
+
|
34
|
+
by default a .ref and a .new file are created in the
|
35
|
+
./test/data/regression directory. A filter can be added to ignore
|
36
|
+
lines of output (as a regex), e.g.
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
RegressionTest::CliExec::exec("ls","-l",:ignore: 'INFO bio-gff3: Memory used')
|
40
|
+
```
|
41
|
+
|
21
42
|
The API doc is online. For more code examples see the test files in
|
22
43
|
the source tree.
|
23
44
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -1,9 +1,14 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module RegressionTest
|
2
4
|
|
3
5
|
DEFAULT_TESTDIR = "test/data/regression"
|
4
6
|
|
5
7
|
# Regression test runner compares output in ./test/data/regression (by default).
|
6
8
|
# The convention is to have a file with names .ref (reference) and create .new
|
9
|
+
#
|
10
|
+
# You can add an :ignore regex option which ignores lines in the comparsion files
|
11
|
+
# matching a regex
|
7
12
|
module CliExec
|
8
13
|
def CliExec::exec command, testname, options = {}
|
9
14
|
# ---- Find .ref file
|
@@ -25,16 +30,35 @@ module RegressionTest
|
|
25
30
|
$stderr.print cmd," returned an error\n"
|
26
31
|
return false
|
27
32
|
end
|
33
|
+
if options[:ignore]
|
34
|
+
regex = options[:ignore]
|
35
|
+
outfn1 = outfn + ".1"
|
36
|
+
FileUtils.mv(outfn,outfn1)
|
37
|
+
buf = []
|
38
|
+
f1 = File.open(outfn1)
|
39
|
+
f = File.open(outfn,"w")
|
40
|
+
f1.each_line do | line |
|
41
|
+
f.print(line) if line !~ /#{regex}/
|
42
|
+
end
|
43
|
+
f1.close
|
44
|
+
f.close
|
45
|
+
FileUtils::rm(outfn1)
|
46
|
+
end
|
28
47
|
# ---- Compare the two files
|
29
|
-
compare_files(outfn,reffn)
|
48
|
+
compare_files(outfn,reffn,options[:ignore])
|
30
49
|
end
|
31
50
|
|
32
|
-
def CliExec::compare_files fn1, fn2
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
51
|
+
def CliExec::compare_files fn1, fn2, ignore = nil
|
52
|
+
if not File.exist?(fn2)
|
53
|
+
FileUtils::cp(fn1,fn2)
|
54
|
+
true
|
55
|
+
else
|
56
|
+
cmd = "diff #{fn2} #{fn1}"
|
57
|
+
$stderr.print cmd+"\n"
|
58
|
+
return true if Kernel.system(cmd) == true
|
59
|
+
$stderr.print "If it is correct, execute \"cp #{fn1} #{fn2}\", and run again"
|
60
|
+
false
|
61
|
+
end
|
38
62
|
end
|
39
63
|
end
|
40
64
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: regressiontest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-20 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: shoulda
|
16
|
-
requirement: &
|
16
|
+
requirement: &21093520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21093520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdoc
|
27
|
-
requirement: &
|
27
|
+
requirement: &21092280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '3.12'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21092280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: cucumber
|
38
|
-
requirement: &
|
38
|
+
requirement: &21089660 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *21089660
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &21088240 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.8.3
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *21088240
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &21086560 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.21
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *21086560
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bio
|
71
|
-
requirement: &
|
71
|
+
requirement: &21084920 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.4.2
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *21084920
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rdoc
|
82
|
-
requirement: &
|
82
|
+
requirement: &21083440 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '3.12'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *21083440
|
91
91
|
description: Regression testing for the command line, and library API
|
92
92
|
email: pjotr.public01@thebird.nl
|
93
93
|
executables:
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: -25856528596506647
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|