cmpfs-ruby 0.2.0 → 0.2.1.1
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.
- checksums.yaml +5 -5
- data/LICENSE +17 -16
- data/README.md +20 -9
- data/lib/cmpfs/compare/api_1_9.rb +121 -120
- data/lib/cmpfs/compare/api_2.rb +109 -108
- data/lib/cmpfs/compare/binary/internal_.rb +50 -52
- data/lib/cmpfs/compare/text/internal_.rb +89 -92
- data/lib/cmpfs/compare.rb +25 -23
- data/lib/cmpfs/version.rb +20 -19
- data/lib/cmpfs.rb +16 -12
- data/test/unit/compare/tc_compare_binary.rb +52 -51
- data/test/unit/tc_compare_binary.rb +53 -54
- data/test/unit/tc_compare_text.rb +85 -31
- data/test/unit/tc_version.rb +19 -16
- metadata +22 -17
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), '../../../lib')
|
4
4
|
|
@@ -10,94 +10,95 @@ require 'test/unit'
|
|
10
10
|
require 'stringio'
|
11
11
|
require 'tempfile'
|
12
12
|
|
13
|
+
|
13
14
|
class Test_CmpFS_Compare_compare_binary < Test::Unit::TestCase
|
14
15
|
|
15
|
-
|
16
|
+
def test__compare_binary__identical_1
|
16
17
|
|
17
|
-
|
18
|
-
|
18
|
+
lhs = StringIO.new 'abcdefghijiklmno'
|
19
|
+
rhs_eq = StringIO.new 'abcdefghijiklmno'
|
19
20
|
|
20
|
-
|
21
|
+
assert CmpFS::Compare.compare_binary(lhs, rhs_eq), 'streams should be the same'
|
21
22
|
|
22
|
-
|
23
|
+
rhs_ne = StringIO.new 'abcdefghijiklmn'
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
assert_false CmpFS::Compare.compare_binary(lhs, rhs_ne), 'streams should not be the same'
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
+
def test__compare_binary__identical_2
|
28
29
|
|
29
|
-
|
30
|
+
lhs_f = Tempfile.new('compare_binary-2')
|
30
31
|
|
31
|
-
|
32
|
+
begin
|
32
33
|
|
33
|
-
|
34
|
+
lhs_f << 'abcdefghijiklmno'
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
lhs_f.rewind
|
37
|
+
lhs_f.close
|
37
38
|
|
38
|
-
|
39
|
+
rhs_eq = StringIO.new 'abcdefghijiklmno'
|
39
40
|
|
40
|
-
|
41
|
+
assert CmpFS::Compare.compare_binary(lhs_f.path, rhs_eq), 'streams should be the same'
|
41
42
|
|
42
|
-
|
43
|
+
rhs_ne = StringIO.new 'abcdefghijiklmnop'
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
assert_false CmpFS::Compare.compare_binary(lhs_f.path, rhs_ne), 'streams should not be the same'
|
46
|
+
ensure
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
lhs_f.unlink
|
49
|
+
end
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
+
def test__compare_binary__identical_3
|
52
53
|
|
53
|
-
|
54
|
+
lhs_f = Tempfile.new('compare_binary-3')
|
54
55
|
|
55
|
-
|
56
|
+
begin
|
56
57
|
|
57
|
-
|
58
|
+
lhs_f << 'abcdefghijiklmno'
|
58
59
|
|
59
|
-
|
60
|
-
|
60
|
+
lhs_f.rewind
|
61
|
+
lhs_f.close
|
61
62
|
|
62
63
|
|
63
|
-
|
64
|
+
rhs_eq_f = Tempfile.new('compare_binary-3')
|
64
65
|
|
65
|
-
|
66
|
+
begin
|
66
67
|
|
67
|
-
|
68
|
+
rhs_eq_f << 'abcdefghijiklmno'
|
68
69
|
|
69
|
-
|
70
|
-
|
70
|
+
rhs_eq_f.rewind
|
71
|
+
rhs_eq_f.close
|
71
72
|
|
72
|
-
|
73
|
-
|
73
|
+
assert CmpFS::Compare.compare_binary(lhs_f.path, rhs_eq_f.path), 'streams should be the same'
|
74
|
+
ensure
|
74
75
|
|
75
|
-
|
76
|
-
|
76
|
+
rhs_eq_f.unlink
|
77
|
+
end
|
77
78
|
|
78
79
|
|
79
|
-
|
80
|
+
rhs_ne_f = Tempfile.new('compare_binary-3')
|
80
81
|
|
81
|
-
|
82
|
+
begin
|
82
83
|
|
83
|
-
|
84
|
+
rhs_ne_f << 'xyz'
|
84
85
|
|
85
|
-
|
86
|
-
|
86
|
+
rhs_ne_f.rewind
|
87
|
+
rhs_ne_f.close
|
87
88
|
|
88
|
-
|
89
|
-
|
89
|
+
assert_false CmpFS::Compare.compare_binary(lhs_f.path, rhs_ne_f.path), 'streams should not be the same'
|
90
|
+
ensure
|
90
91
|
|
91
|
-
|
92
|
-
|
92
|
+
rhs_ne_f.unlink
|
93
|
+
end
|
93
94
|
|
94
|
-
|
95
|
+
ensure
|
95
96
|
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
lhs_f.unlink
|
98
|
+
end
|
99
|
+
end
|
99
100
|
end
|
100
101
|
|
101
|
-
# ############################## end of file ############################# #
|
102
102
|
|
103
|
+
# ############################## end of file ############################# #
|
103
104
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), '../../lib')
|
4
4
|
|
@@ -10,98 +10,97 @@ require 'test/unit'
|
|
10
10
|
require 'stringio'
|
11
11
|
require 'tempfile'
|
12
12
|
|
13
|
-
class Test_CmpFS_compare_binary < Test::Unit::TestCase
|
14
|
-
|
15
|
-
include ::CmpFS
|
16
13
|
|
17
|
-
|
14
|
+
class Test_CmpFS_compare_binary < Test::Unit::TestCase
|
18
15
|
|
19
|
-
|
20
|
-
rhs_eq = StringIO.new 'abcdefghijiklmno'
|
16
|
+
include ::CmpFS
|
21
17
|
|
22
|
-
|
18
|
+
def test__compare_binary__identical_1
|
23
19
|
|
24
|
-
|
20
|
+
lhs = StringIO.new 'abcdefghijiklmno'
|
21
|
+
rhs_eq = StringIO.new 'abcdefghijiklmno'
|
25
22
|
|
26
|
-
|
27
|
-
end
|
23
|
+
assert compare_binary(lhs, rhs_eq), 'streams should be the same'
|
28
24
|
|
29
|
-
|
25
|
+
rhs_ne = StringIO.new 'abcdefghijiklmn'
|
30
26
|
|
31
|
-
|
27
|
+
assert_false compare_binary(lhs, rhs_ne), 'streams should not be the same'
|
28
|
+
end
|
32
29
|
|
33
|
-
|
30
|
+
def test__compare_binary__identical_2
|
34
31
|
|
35
|
-
|
32
|
+
lhs_f = Tempfile.new('compare_binary-2')
|
36
33
|
|
37
|
-
|
38
|
-
lhs_f.close
|
34
|
+
begin
|
39
35
|
|
40
|
-
|
36
|
+
lhs_f << 'abcdefghijiklmno'
|
41
37
|
|
42
|
-
|
38
|
+
lhs_f.rewind
|
39
|
+
lhs_f.close
|
43
40
|
|
44
|
-
|
41
|
+
rhs_eq = StringIO.new 'abcdefghijiklmno'
|
45
42
|
|
46
|
-
|
47
|
-
ensure
|
43
|
+
assert compare_binary(lhs_f.path, rhs_eq), 'streams should be the same'
|
48
44
|
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
45
|
+
rhs_ne = StringIO.new 'abcdefghijiklmnop'
|
52
46
|
|
53
|
-
|
47
|
+
assert_false compare_binary(lhs_f.path, rhs_ne), 'streams should not be the same'
|
48
|
+
ensure
|
54
49
|
|
55
|
-
|
50
|
+
lhs_f.unlink
|
51
|
+
end
|
52
|
+
end
|
56
53
|
|
57
|
-
|
54
|
+
def test__compare_binary__identical_3
|
58
55
|
|
59
|
-
|
56
|
+
lhs_f = Tempfile.new('compare_binary-3')
|
60
57
|
|
61
|
-
|
62
|
-
lhs_f.close
|
58
|
+
begin
|
63
59
|
|
60
|
+
lhs_f << 'abcdefghijiklmno'
|
64
61
|
|
65
|
-
|
62
|
+
lhs_f.rewind
|
63
|
+
lhs_f.close
|
66
64
|
|
67
|
-
begin
|
68
65
|
|
69
|
-
|
66
|
+
rhs_eq_f = Tempfile.new('compare_binary-3')
|
70
67
|
|
71
|
-
|
72
|
-
rhs_eq_f.close
|
68
|
+
begin
|
73
69
|
|
70
|
+
rhs_eq_f << 'abcdefghijiklmno'
|
74
71
|
|
75
|
-
|
76
|
-
|
72
|
+
rhs_eq_f.rewind
|
73
|
+
rhs_eq_f.close
|
77
74
|
|
78
|
-
|
79
|
-
|
75
|
+
assert compare_binary(lhs_f.path, rhs_eq_f.path), 'streams should be the same'
|
76
|
+
ensure
|
80
77
|
|
78
|
+
rhs_eq_f.unlink
|
79
|
+
end
|
81
80
|
|
82
|
-
rhs_ne_f = Tempfile.new('compare_binary-3')
|
83
81
|
|
84
|
-
|
82
|
+
rhs_ne_f = Tempfile.new('compare_binary-3')
|
85
83
|
|
86
|
-
|
84
|
+
begin
|
87
85
|
|
88
|
-
|
89
|
-
rhs_ne_f.close
|
86
|
+
rhs_ne_f << 'xyz'
|
90
87
|
|
88
|
+
rhs_ne_f.rewind
|
89
|
+
rhs_ne_f.close
|
91
90
|
|
92
|
-
|
93
|
-
|
91
|
+
assert_false compare_binary(lhs_f.path, rhs_ne_f.path), 'streams should not be the same'
|
92
|
+
ensure
|
94
93
|
|
95
|
-
|
96
|
-
|
94
|
+
rhs_ne_f.unlink
|
95
|
+
end
|
97
96
|
|
98
|
-
|
97
|
+
ensure
|
99
98
|
|
100
|
-
|
101
|
-
|
102
|
-
|
99
|
+
lhs_f.unlink
|
100
|
+
end
|
101
|
+
end
|
103
102
|
end
|
104
103
|
|
105
|
-
# ############################## end of file ############################# #
|
106
104
|
|
105
|
+
# ############################## end of file ############################# #
|
107
106
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), '../../lib')
|
4
4
|
|
@@ -10,56 +10,110 @@ require 'test/unit'
|
|
10
10
|
require 'stringio'
|
11
11
|
require 'tempfile'
|
12
12
|
|
13
|
+
|
13
14
|
class Test_CmpFS_compare_text < Test::Unit::TestCase
|
14
15
|
|
15
|
-
|
16
|
+
include ::CmpFS
|
17
|
+
|
18
|
+
def test__compare_text__empty
|
19
|
+
|
20
|
+
lhs = StringIO.new
|
21
|
+
rhs_eq = StringIO.new
|
22
|
+
|
23
|
+
assert compare_text(lhs, rhs_eq), 'streams should be the same'
|
24
|
+
end
|
25
|
+
|
26
|
+
def test__compare_text__blank_lines
|
27
|
+
|
28
|
+
lhs = StringIO.new <<END_OF_INPUT
|
29
|
+
|
30
|
+
|
31
|
+
END_OF_INPUT
|
32
|
+
rhs_eq = StringIO.new <<END_OF_INPUT
|
33
|
+
|
16
34
|
|
17
|
-
|
35
|
+
END_OF_INPUT
|
18
36
|
|
19
|
-
|
20
|
-
|
37
|
+
assert compare_text(lhs, rhs_eq), 'streams should be the same'
|
38
|
+
end
|
21
39
|
|
22
|
-
|
23
|
-
rhs_eq << "line-1\n"
|
40
|
+
def test__compare_text__identical_lines_1
|
24
41
|
|
25
|
-
|
26
|
-
|
42
|
+
lhs = StringIO.new <<END_OF_INPUT
|
43
|
+
line-1
|
44
|
+
line-2
|
27
45
|
|
28
|
-
|
46
|
+
END_OF_INPUT
|
47
|
+
rhs_eq = StringIO.new <<END_OF_INPUT
|
48
|
+
line-1
|
49
|
+
line-2
|
29
50
|
|
30
|
-
|
51
|
+
END_OF_INPUT
|
31
52
|
|
32
|
-
|
33
|
-
|
53
|
+
assert compare_text(lhs, rhs_eq), 'streams should be the same'
|
54
|
+
end
|
34
55
|
|
35
|
-
|
36
|
-
end
|
56
|
+
def test__compare_text__different_lines_1
|
37
57
|
|
38
|
-
|
58
|
+
lhs = StringIO.new <<END_OF_INPUT
|
59
|
+
line-1
|
60
|
+
line-2
|
39
61
|
|
40
|
-
|
41
|
-
|
62
|
+
END_OF_INPUT
|
63
|
+
rhs_ne = StringIO.new <<END_OF_INPUT
|
64
|
+
line-1
|
65
|
+
line2
|
42
66
|
|
43
|
-
|
44
|
-
lhs << "\n"
|
45
|
-
rhs_eq << "line-1\n"
|
67
|
+
END_OF_INPUT
|
46
68
|
|
47
|
-
|
48
|
-
|
69
|
+
assert_false compare_text(lhs, rhs_ne), 'streams should not be the same'
|
70
|
+
end
|
49
71
|
|
50
|
-
|
51
|
-
assert compare_text(lhs, rhs_eq, trim_lines: true, skip_blank_lines: true), 'streams should be the same'
|
72
|
+
def test__compare_text__different_lines_2
|
52
73
|
|
53
|
-
|
74
|
+
lhs = StringIO.new <<END_OF_INPUT
|
75
|
+
line-1
|
54
76
|
|
55
|
-
|
56
|
-
|
77
|
+
line-2
|
78
|
+
END_OF_INPUT
|
79
|
+
rhs_ne = StringIO.new <<END_OF_INPUT
|
80
|
+
line-1
|
81
|
+
line-2
|
57
82
|
|
58
|
-
|
59
|
-
end
|
83
|
+
END_OF_INPUT
|
60
84
|
|
85
|
+
assert_false compare_text(lhs, rhs_ne), 'streams should not be the same'
|
86
|
+
end
|
87
|
+
|
88
|
+
def test__compare_text__different_streams_with_permutations_of_trim_and_skip_1
|
89
|
+
|
90
|
+
lhs = StringIO.new <<END_OF_INPUT
|
91
|
+
line-1
|
92
|
+
|
93
|
+
line-2
|
94
|
+
END_OF_INPUT
|
95
|
+
rhs_eq = StringIO.new <<END_OF_INPUT
|
96
|
+
line-1
|
97
|
+
line-2
|
98
|
+
END_OF_INPUT
|
99
|
+
|
100
|
+
assert_false compare_text(lhs, rhs_eq), 'streams should not be the same'
|
101
|
+
assert_false compare_text(lhs, rhs_eq, trim_lines: false, skip_blank_lines: true), 'streams should not be the same'
|
102
|
+
assert_false compare_text(lhs, rhs_eq, trim_lines: true, skip_blank_lines: false), 'streams should not be the same'
|
103
|
+
assert compare_text(lhs, rhs_eq, trim_lines: true, skip_blank_lines: true), 'streams should be the same'
|
104
|
+
|
105
|
+
rhs_ne = StringIO.new <<END_OF_INPUT
|
106
|
+
line-1
|
107
|
+
line2
|
108
|
+
END_OF_INPUT
|
109
|
+
|
110
|
+
assert_false compare_text(lhs, rhs_ne), 'streams should not be the same'
|
111
|
+
assert_false compare_text(lhs, rhs_ne, trim_lines: false, skip_blank_lines: true), 'streams should not be the same'
|
112
|
+
assert_false compare_text(lhs, rhs_ne, trim_lines: true, skip_blank_lines: false), 'streams should not be the same'
|
113
|
+
assert_false compare_text(lhs, rhs_ne, trim_lines: true, skip_blank_lines: true), 'streams should not be the same'
|
114
|
+
end
|
61
115
|
end
|
62
116
|
|
63
|
-
# ############################## end of file ############################# #
|
64
117
|
|
118
|
+
# ############################## end of file ############################# #
|
65
119
|
|
data/test/unit/tc_version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), '../../lib')
|
4
4
|
|
@@ -9,29 +9,32 @@ require 'test/unit'
|
|
9
9
|
|
10
10
|
class Test_version < Test::Unit::TestCase
|
11
11
|
|
12
|
-
|
12
|
+
def test__VERSION
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
assert defined? CmpFS::VERSION
|
15
|
+
end
|
16
16
|
|
17
|
-
|
17
|
+
def test__VERSION_MAJOR
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
assert defined? CmpFS::VERSION_MAJOR
|
20
|
+
end
|
21
21
|
|
22
|
-
|
22
|
+
def test__VERSION_MINOR
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
assert defined? CmpFS::VERSION_MINOR
|
25
|
+
end
|
26
26
|
|
27
|
-
|
27
|
+
def test__VERSION_REVISION
|
28
28
|
|
29
|
-
|
30
|
-
|
29
|
+
assert defined? CmpFS::VERSION_REVISION
|
30
|
+
end
|
31
31
|
|
32
|
-
|
32
|
+
def test__VERSION_has_consistent_format
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
version = CmpFS::VERSION
|
35
|
+
j_n_p = "#{CmpFS::VERSION_MAJOR}.#{CmpFS::VERSION_MINOR}.#{CmpFS::VERSION_PATCH}"
|
36
|
+
|
37
|
+
assert_match /^#{j_n_p}(|\..+)$/, version
|
38
|
+
end
|
36
39
|
end
|
37
40
|
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cmpfs-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wilson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xqsr3
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.39'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.39.1
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.39'
|
30
|
+
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 0.39.1
|
27
33
|
description: |
|
28
34
|
Compare File-System entities, for Ruby is a library that provides comparison
|
29
35
|
functions for file-system entities - files and streams - including binary and
|
@@ -33,43 +39,42 @@ executables: []
|
|
33
39
|
extensions: []
|
34
40
|
extra_rdoc_files: []
|
35
41
|
files:
|
42
|
+
- LICENSE
|
43
|
+
- README.md
|
44
|
+
- lib/cmpfs.rb
|
45
|
+
- lib/cmpfs/compare.rb
|
36
46
|
- lib/cmpfs/compare/api_1_9.rb
|
37
47
|
- lib/cmpfs/compare/api_2.rb
|
38
48
|
- lib/cmpfs/compare/binary/internal_.rb
|
39
49
|
- lib/cmpfs/compare/text/internal_.rb
|
40
|
-
- lib/cmpfs/compare.rb
|
41
50
|
- lib/cmpfs/version.rb
|
42
|
-
- lib/cmpfs.rb
|
43
51
|
- test/unit/compare/tc_compare_binary.rb
|
44
52
|
- test/unit/compare/ts_all.rb
|
45
53
|
- test/unit/tc_compare_binary.rb
|
46
54
|
- test/unit/tc_compare_text.rb
|
47
55
|
- test/unit/tc_version.rb
|
48
56
|
- test/unit/ts_all.rb
|
49
|
-
- README.md
|
50
|
-
- LICENSE
|
51
57
|
homepage: http://github.com/synesissoftware/cmpfs.Ruby
|
52
58
|
licenses:
|
53
59
|
- BSD 3-Clause
|
54
60
|
metadata: {}
|
55
|
-
post_install_message:
|
61
|
+
post_install_message:
|
56
62
|
rdoc_options: []
|
57
63
|
require_paths:
|
58
64
|
- lib
|
59
65
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
66
|
requirements:
|
61
|
-
- - ~>
|
67
|
+
- - "~>"
|
62
68
|
- !ruby/object:Gem::Version
|
63
69
|
version: '2.0'
|
64
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- -
|
72
|
+
- - ">="
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
75
|
requirements: []
|
70
|
-
|
71
|
-
|
72
|
-
signing_key:
|
76
|
+
rubygems_version: 3.3.7
|
77
|
+
signing_key:
|
73
78
|
specification_version: 4
|
74
79
|
summary: CmpFS.Ruby
|
75
80
|
test_files: []
|