reapack-index 1.0 → 1.1beta1
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 +4 -4
- data/README.md +3 -1
- data/lib/reapack/index.rb +10 -13
- data/lib/reapack/index/cli.rb +6 -3
- data/lib/reapack/index/cli/options.rb +22 -12
- data/lib/reapack/index/gem_version.rb +1 -1
- data/lib/reapack/index/git.rb +1 -1
- data/lib/reapack/index/metadata.rb +46 -6
- data/lib/reapack/index/package.rb +31 -6
- data/lib/reapack/index/scanner.rb +54 -13
- data/lib/reapack/index/version.rb +3 -4
- data/reapack-index.gemspec +1 -1
- data/setup/reapack-index.nsi +2 -2
- data/test/cli/test_metadata.rb +13 -0
- data/test/cli/test_scan.rb +14 -0
- data/test/data/index.xml +1 -1
- data/test/index/test_metadata.rb +5 -5
- data/test/index/test_scan.rb +31 -103
- data/test/scanner/test_makeurl.rb +102 -0
- data/test/scanner/test_validation.rb +126 -0
- data/test/test_git.rb +10 -0
- data/test/test_index.rb +35 -25
- data/test/test_metadata.rb +115 -19
- data/test/test_package.rb +55 -5
- data/test/test_scanner.rb +113 -140
- data/test/test_source.rb +16 -0
- metadata +10 -6
@@ -42,7 +42,6 @@ class ReaPack::Index
|
|
42
42
|
|
43
43
|
def time=(new_time)
|
44
44
|
return if new_time == time
|
45
|
-
|
46
45
|
if new_time.nil?
|
47
46
|
@node.remove_attribute TIME
|
48
47
|
else
|
@@ -61,7 +60,7 @@ class ReaPack::Index
|
|
61
60
|
yield
|
62
61
|
|
63
62
|
new_sources = hash_sources children(Source::TAG)
|
64
|
-
@dirty =
|
63
|
+
@dirty = old_sources != new_sources unless was_dirty
|
65
64
|
|
66
65
|
raise Error, 'no files provided' if new_sources.empty?
|
67
66
|
end
|
@@ -74,8 +73,8 @@ class ReaPack::Index
|
|
74
73
|
|
75
74
|
private
|
76
75
|
def hash_sources(nodes)
|
77
|
-
nodes.map {|
|
78
|
-
[
|
76
|
+
nodes.map {|node|
|
77
|
+
[node[Source::PLATFORM] || 'all', node[Source::FILE], node.content]
|
79
78
|
}
|
80
79
|
end
|
81
80
|
end
|
data/reapack-index.gemspec
CHANGED
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_runtime_dependency 'addressable', '~> 2.4'
|
30
30
|
spec.add_runtime_dependency 'colorize', '~> 0.7'
|
31
31
|
spec.add_runtime_dependency 'gitable', '~> 0.3'
|
32
|
-
spec.add_runtime_dependency 'metaheader', '~> 1.
|
32
|
+
spec.add_runtime_dependency 'metaheader', '~> 1.3beta1'
|
33
33
|
spec.add_runtime_dependency 'nokogiri', '~> 1.6.8'
|
34
34
|
spec.add_runtime_dependency 'pandoc-ruby', '~> 2.0'
|
35
35
|
spec.add_runtime_dependency 'rugged', '~> 0.24'
|
data/setup/reapack-index.nsi
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
!include Sections.nsh
|
3
3
|
!include StrRep.nsh
|
4
4
|
|
5
|
-
!define VERSION "1.
|
5
|
+
!define VERSION "1.1beta1"
|
6
6
|
!define NAME "ReaPack Index ${VERSION}"
|
7
7
|
!define LONG_VERSION "0.1.0.0"
|
8
8
|
|
9
|
-
!define RUBY_VERSION "2.3.
|
9
|
+
!define RUBY_VERSION "2.3.0"
|
10
10
|
!define RUBYINSTALLER_FILE "rubyinstaller-${RUBY_VERSION}.exe"
|
11
11
|
!define RUBYINSTALLER_URL \
|
12
12
|
"http://dl.bintray.com/oneclick/rubyinstaller/${RUBYINSTALLER_FILE}"
|
data/test/cli/test_metadata.rb
CHANGED
@@ -26,8 +26,20 @@ class TestCLI::Metadata < MiniTest::Test
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
def test_screenshot_link
|
30
|
+
wrapper ['--screenshot-link', 'Link Label http://cfillion.tk'] do
|
31
|
+
assert_output "1 new screenshot link, empty index\n" do
|
32
|
+
assert_equal true, @cli.run
|
33
|
+
end
|
34
|
+
|
35
|
+
assert_match 'rel="screenshot" href="http://cfillion.tk">Link Label</link>',
|
36
|
+
read_index
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
29
40
|
def test_invalid_link
|
30
41
|
wrapper ['--link', 'shinsekai yori', '--donation-link', 'hello world',
|
42
|
+
'--screenshot-link', 'chunky bacon',
|
31
43
|
'--link', 'http://cfillion.tk'] do
|
32
44
|
stdout, stderr = capture_io do
|
33
45
|
assert_equal true, @cli.run
|
@@ -36,6 +48,7 @@ class TestCLI::Metadata < MiniTest::Test
|
|
36
48
|
assert_equal "1 new website link, empty index\n", stdout
|
37
49
|
assert_match /warning: --link: invalid link 'shinsekai yori'/i, stderr
|
38
50
|
assert_match /warning: --donation-link: invalid link 'hello world'/i, stderr
|
51
|
+
assert_match /warning: --screenshot-link: invalid link 'chunky bacon'/i, stderr
|
39
52
|
assert_match 'rel="website">http://cfillion.tk</link>', read_index
|
40
53
|
end
|
41
54
|
end
|
data/test/cli/test_scan.rb
CHANGED
@@ -426,4 +426,18 @@ processing [a-f0-9]{7}: third commit
|
|
426
426
|
def test_no_arguments
|
427
427
|
wrapper ['--scan'] do; end
|
428
428
|
end
|
429
|
+
|
430
|
+
def test_strict_mode
|
431
|
+
wrapper do
|
432
|
+
refute @cli.index.strict
|
433
|
+
end
|
434
|
+
|
435
|
+
wrapper ['--no-strict'] do
|
436
|
+
refute @cli.index.strict
|
437
|
+
end
|
438
|
+
|
439
|
+
wrapper ['--strict'] do
|
440
|
+
assert @cli.index.strict
|
441
|
+
end
|
442
|
+
end
|
429
443
|
end
|
data/test/data/index.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<index version="1" commit="f572d396fae9206628714fb2ce00f72e94f2258f" name="Test">
|
3
3
|
<category name="Category Name">
|
4
4
|
<reapack name="Hello World.lua" type="script">
|
5
|
-
<version name="1.0" author="cfillion">
|
5
|
+
<version name="1.0" author="cfillion" time="2015-01-01T00:00:00Z">
|
6
6
|
<changelog><![CDATA[Fixed a division by zero error.]]></changelog>
|
7
7
|
<source>https://google.com/Category%20Name/Hello%20World.lua</source>
|
8
8
|
</version>
|
data/test/index/test_metadata.rb
CHANGED
@@ -70,21 +70,21 @@ class TestIndex::Metadata < MiniTest::Test
|
|
70
70
|
assert_equal '1 new website link, 1 removed website link, empty index', index.changelog
|
71
71
|
end
|
72
72
|
|
73
|
-
def
|
73
|
+
def test_about
|
74
74
|
index = ReaPack::Index.new @dummy_path
|
75
75
|
index.write!
|
76
76
|
|
77
|
-
assert_empty index.
|
77
|
+
assert_empty index.about
|
78
78
|
assert_equal false, index.modified?
|
79
79
|
|
80
|
-
index.
|
81
|
-
refute_empty index.
|
80
|
+
index.about = 'Hello World'
|
81
|
+
refute_empty index.about
|
82
82
|
assert_equal true, index.modified?
|
83
83
|
assert_equal '1 modified metadata', index.changelog
|
84
84
|
|
85
85
|
index.write!
|
86
86
|
|
87
|
-
index.
|
87
|
+
index.about = 'Hello World'
|
88
88
|
assert_equal false, index.modified?
|
89
89
|
end
|
90
90
|
|
data/test/index/test_scan.rb
CHANGED
@@ -68,85 +68,6 @@ class TestIndex::Scan < MiniTest::Test
|
|
68
68
|
refute_match '<reapack', File.read(index.path)
|
69
69
|
end
|
70
70
|
|
71
|
-
def test_edit_version_amend_off
|
72
|
-
index = ReaPack::Index.new @real_path
|
73
|
-
assert_equal false, index.amend
|
74
|
-
|
75
|
-
index.url_template = 'http://google.com/$path'
|
76
|
-
index.files = ['Category Name/Hello World.lua']
|
77
|
-
|
78
|
-
index.scan index.files.first, <<-IN
|
79
|
-
@version 1.0
|
80
|
-
@changelog New Changelog!
|
81
|
-
IN
|
82
|
-
|
83
|
-
assert_equal false, index.modified?
|
84
|
-
assert_empty index.changelog
|
85
|
-
end
|
86
|
-
|
87
|
-
def test_edit_version_amend_on
|
88
|
-
index = ReaPack::Index.new @real_path
|
89
|
-
index.commit = @commit
|
90
|
-
index.files = ['Category Name/Hello World.lua']
|
91
|
-
index.time = Time.now # must not be added to the index in amend mode
|
92
|
-
index.url_template = 'http://google.com/$path'
|
93
|
-
|
94
|
-
index.amend = true
|
95
|
-
assert_equal true, index.amend
|
96
|
-
|
97
|
-
index.scan index.files.first, <<-IN
|
98
|
-
@version 1.0
|
99
|
-
@changelog Intermediate Changelog!
|
100
|
-
IN
|
101
|
-
|
102
|
-
# when reindexing the same file a second time,
|
103
|
-
# the changelog is expected to only have been bumped a single time
|
104
|
-
index.scan index.files.first, <<-IN
|
105
|
-
@version 1.0
|
106
|
-
@changelog New Changelog!
|
107
|
-
IN
|
108
|
-
|
109
|
-
assert index.modified?, 'index is not modified'
|
110
|
-
assert_equal '1 modified package, 1 modified version', index.changelog
|
111
|
-
|
112
|
-
index.write @dummy_path
|
113
|
-
contents = File.read @dummy_path
|
114
|
-
|
115
|
-
assert_match @commit, contents
|
116
|
-
assert_match 'New Changelog!', contents
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_edit_version_amend_unmodified
|
120
|
-
index = ReaPack::Index.new @real_path
|
121
|
-
index.amend = true
|
122
|
-
|
123
|
-
index.url_template = 'https://google.com/$path'
|
124
|
-
index.files = ['Category Name/Hello World.lua']
|
125
|
-
|
126
|
-
index.scan index.files.first, <<-IN
|
127
|
-
@version 1.0
|
128
|
-
@author cfillion
|
129
|
-
@changelog Fixed a division by zero error.
|
130
|
-
IN
|
131
|
-
|
132
|
-
assert_equal false, index.modified?
|
133
|
-
assert_empty index.changelog
|
134
|
-
end
|
135
|
-
|
136
|
-
def test_author
|
137
|
-
index = ReaPack::Index.new @dummy_path
|
138
|
-
index.url_template = 'http://host/$path'
|
139
|
-
index.files = ['Category/script.lua']
|
140
|
-
|
141
|
-
index.scan index.files.first, <<-IN
|
142
|
-
@version 1.0
|
143
|
-
@author cfillion
|
144
|
-
IN
|
145
|
-
|
146
|
-
index.write!
|
147
|
-
assert_match '<version name="1.0" author="cfillion">', File.read(index.path)
|
148
|
-
end
|
149
|
-
|
150
71
|
def test_noindex
|
151
72
|
index = ReaPack::Index.new @real_path
|
152
73
|
|
@@ -171,37 +92,17 @@ class TestIndex::Scan < MiniTest::Test
|
|
171
92
|
refute_match '<category', contents
|
172
93
|
end
|
173
94
|
|
174
|
-
def
|
95
|
+
def test_strict_mode
|
175
96
|
index = ReaPack::Index.new @dummy_path
|
97
|
+
index.strict = true
|
176
98
|
index.url_template = 'http://host/$path'
|
177
99
|
index.files = ['Category/script.lua']
|
178
100
|
|
179
101
|
error = assert_raises ReaPack::Index::Error do
|
180
|
-
index.scan index.files.first, "@version 1.0\n@
|
102
|
+
index.scan index.files.first, "@version 1.0\n@qwerty"
|
181
103
|
end
|
182
104
|
|
183
|
-
assert_equal
|
184
|
-
end
|
185
|
-
|
186
|
-
def test_metapackage_off
|
187
|
-
index = ReaPack::Index.new @dummy_path
|
188
|
-
index.url_template = 'http://host/$path'
|
189
|
-
index.files = ['Category/extension.ext']
|
190
|
-
|
191
|
-
index.scan index.files.first, "@version 1.0\n@metapackage false"
|
192
|
-
end
|
193
|
-
|
194
|
-
def test_version_time
|
195
|
-
index = ReaPack::Index.new @dummy_path
|
196
|
-
index.url_template = 'http://host/$path'
|
197
|
-
index.files = ['Category/script.lua']
|
198
|
-
index.time = Time.new 2016, 2, 11, 20, 16, 40, -5 * 3600
|
199
|
-
|
200
|
-
index.scan index.files.first, '@version 1.0'
|
201
|
-
|
202
|
-
index.write!
|
203
|
-
assert_match '<version name="1.0" time="2016-02-12T01:16:40Z">',
|
204
|
-
File.read(index.path)
|
105
|
+
assert_equal "unknown tag 'qwerty'", error.message
|
205
106
|
end
|
206
107
|
|
207
108
|
def test_extension
|
@@ -278,4 +179,31 @@ class TestIndex::Scan < MiniTest::Test
|
|
278
179
|
index.write!
|
279
180
|
assert_equal expected, File.read(index.path)
|
280
181
|
end
|
182
|
+
|
183
|
+
def test_theme
|
184
|
+
index = ReaPack::Index.new @dummy_path
|
185
|
+
index.url_template = 'http://host/$path'
|
186
|
+
index.files = ['Themes/Default_4.0 + width.theme']
|
187
|
+
|
188
|
+
index.scan index.files.first, <<-IN
|
189
|
+
@version 1.0
|
190
|
+
@provides Default_4.0_width.ReaperThemeZip http://stash.reaper.fm/27310/$path
|
191
|
+
IN
|
192
|
+
|
193
|
+
expected = <<-XML
|
194
|
+
<?xml version="1.0" encoding="utf-8"?>
|
195
|
+
<index version="1">
|
196
|
+
<category name="Themes">
|
197
|
+
<reapack name="Default_4.0 + width.theme" type="theme">
|
198
|
+
<version name="1.0">
|
199
|
+
<source file="Default_4.0_width.ReaperThemeZip">http://stash.reaper.fm/27310/Default_4.0_width.ReaperThemeZip</source>
|
200
|
+
</version>
|
201
|
+
</reapack>
|
202
|
+
</category>
|
203
|
+
</index>
|
204
|
+
XML
|
205
|
+
|
206
|
+
index.write!
|
207
|
+
assert_equal expected, File.read(index.path)
|
208
|
+
end
|
281
209
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require File.expand_path '../../helper', __FILE__
|
2
|
+
|
3
|
+
TestScanner ||= Class.new MiniTest::Test
|
4
|
+
|
5
|
+
class TestScanner::TestMakeUrl < MiniTest::Test
|
6
|
+
def setup
|
7
|
+
@cat = MiniTest::Mock.new
|
8
|
+
|
9
|
+
@pkg = MiniTest::Mock.new
|
10
|
+
@pkg.expect :path, 'Hello/World.lua'
|
11
|
+
@pkg.expect :path, 'Hello/World.lua'
|
12
|
+
|
13
|
+
@ver = MiniTest::Mock.new
|
14
|
+
@ver.expect :name, '1.0'
|
15
|
+
|
16
|
+
@cdetector = MiniTest::Mock.new
|
17
|
+
@cdetector.expect :[], nil, ['Hello/World.lua']
|
18
|
+
|
19
|
+
@index = MiniTest::Mock.new
|
20
|
+
@index.expect :cdetector, @cdetector
|
21
|
+
|
22
|
+
@scanner = ReaPack::Index::Scanner.new @cat, @pkg, nil, @index
|
23
|
+
@scanner.instance_variable_set :@ver, @ver
|
24
|
+
end
|
25
|
+
|
26
|
+
def teardown
|
27
|
+
[@cat, @pkg, @ver, @index, @cdetector].each {|mock| mock.verify }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_path
|
31
|
+
@index.expect :files, ['Category/script.lua']
|
32
|
+
@index.expect :url_template, '$path'
|
33
|
+
@index.expect :commit, 'C0FF33'
|
34
|
+
|
35
|
+
assert_equal 'Category/script.lua', @scanner.make_url('Category/script.lua')
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_commit
|
39
|
+
@index.expect :files, ['Hello/World.lua']
|
40
|
+
@index.expect :url_template, '$commit'
|
41
|
+
@index.expect :commit, 'C0FF33'
|
42
|
+
|
43
|
+
assert_equal 'C0FF33', @scanner.make_url('Hello/World.lua')
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_defaut_branch
|
47
|
+
@index.expect :commit, nil
|
48
|
+
|
49
|
+
assert_match 'master', @scanner.make_url('Category/script.lua', '$commit')
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_version
|
53
|
+
@index.expect :files, ['Category/script.lua']
|
54
|
+
@index.expect :url_template, '$version'
|
55
|
+
@index.expect :commit, 'C0FF33'
|
56
|
+
|
57
|
+
assert_equal '1.0', @scanner.make_url('Category/script.lua')
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_package
|
61
|
+
@index.expect :files, ['Category/script.lua']
|
62
|
+
@index.expect :url_template, '$package'
|
63
|
+
@index.expect :commit, 'C0FF33'
|
64
|
+
|
65
|
+
assert_equal 'Hello/World.lua', @scanner.make_url('Category/script.lua')
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_without_template
|
69
|
+
@index.expect :commit, nil
|
70
|
+
@scanner.make_url 'script.lua', 'ok if explicit template'
|
71
|
+
|
72
|
+
@index.expect :url_template, nil
|
73
|
+
error = assert_raises ReaPack::Index::Error do
|
74
|
+
@scanner.make_url 'script.lua'
|
75
|
+
end
|
76
|
+
|
77
|
+
assert_match /url template/i, error.message
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_unlisted
|
81
|
+
@index.expect :commit, nil
|
82
|
+
@index.expect :files, []
|
83
|
+
@index.expect :url_template, 'http://implicit/url/template'
|
84
|
+
|
85
|
+
@scanner.make_url 'unlisted.lua', 'ok with explicit url template'
|
86
|
+
|
87
|
+
error = assert_raises ReaPack::Index::Error do
|
88
|
+
@scanner.make_url 'unlisted.lua'
|
89
|
+
end
|
90
|
+
|
91
|
+
assert_equal "file not found 'unlisted.lua'", error.message
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_repeat
|
95
|
+
@index.expect :files, ['Category/script.lua']
|
96
|
+
@index.expect :url_template, '$path $path'
|
97
|
+
@index.expect :commit, 'C0FF33'
|
98
|
+
|
99
|
+
assert_equal 'Category/script.lua Category/script.lua',
|
100
|
+
@scanner.make_url('Category/script.lua')
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require File.expand_path '../../helper', __FILE__
|
2
|
+
|
3
|
+
TestScanner ||= Class.new MiniTest::Test
|
4
|
+
|
5
|
+
class TestScanner::TestValidation < MiniTest::Test
|
6
|
+
def setup
|
7
|
+
@pkg = MiniTest::Mock.new
|
8
|
+
@pkg.expect :type, :script
|
9
|
+
@pkg.expect :path, 'cat/test'
|
10
|
+
|
11
|
+
@mh = MetaHeader.new String.new
|
12
|
+
@mh[:version] = '1.0'
|
13
|
+
|
14
|
+
@index = MiniTest::Mock.new
|
15
|
+
@index.expect :cdetector, ReaPack::Index::ConflictDetector.new
|
16
|
+
|
17
|
+
@scanner = ReaPack::Index::Scanner.new nil, @pkg, @mh, @index
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_validation
|
21
|
+
mh_mock = MiniTest::Mock.new
|
22
|
+
mh_mock.expect :alias, nil, [Hash]
|
23
|
+
mh_mock.expect :validate, ['first', 'second'], [Hash]
|
24
|
+
|
25
|
+
@scanner.instance_variable_set :@mh, mh_mock
|
26
|
+
|
27
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
28
|
+
|
29
|
+
assert_equal "first\nsecond", error.message
|
30
|
+
mh_mock.verify
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_version
|
34
|
+
@mh.delete :version
|
35
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
36
|
+
assert_equal "missing tag 'version'", error.message
|
37
|
+
|
38
|
+
@mh[:version] = 'no.numbers'
|
39
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
40
|
+
assert_equal "invalid value for tag 'version'", error.message
|
41
|
+
|
42
|
+
@mh[:version] = 'v1.0'
|
43
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
44
|
+
assert_equal "invalid value for tag 'version'", error.message
|
45
|
+
|
46
|
+
@mh[:version] = true
|
47
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
48
|
+
assert_equal "missing value for tag 'version'", error.message
|
49
|
+
|
50
|
+
@mh[:version] = "hello\nworld"
|
51
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
52
|
+
assert_equal "tag 'version' must be singleline", error.message
|
53
|
+
|
54
|
+
@mh[:version] = '1.99999'
|
55
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
56
|
+
assert_equal "invalid value for tag 'version': segment overflow (99999 > 65535)",
|
57
|
+
error.message
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_author
|
61
|
+
@mh[:author] = true
|
62
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
63
|
+
assert_equal "missing value for tag 'author'", error.message
|
64
|
+
|
65
|
+
@mh[:author] = "hello\nworld"
|
66
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
67
|
+
assert_equal "tag 'author' must be singleline", error.message
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_changelog
|
71
|
+
@mh[:changelog] = true
|
72
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
73
|
+
assert_equal "missing value for tag 'changelog'", error.message
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_provides
|
77
|
+
@mh[:provides] = true
|
78
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
79
|
+
assert_equal "missing value for tag 'provides'", error.message
|
80
|
+
|
81
|
+
@mh[:provides] = '[hello] world'
|
82
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
83
|
+
assert_equal "invalid value for tag 'provides': unknown option 'hello'",
|
84
|
+
error.message
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_index
|
88
|
+
@mh[:noindex] = 'value'
|
89
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
90
|
+
assert_equal "tag 'noindex' cannot have a value", error.message
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_metapackage
|
94
|
+
@mh[:metapackage] = 'value'
|
95
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
96
|
+
assert_equal "tag 'metapackage' cannot have a value", error.message
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_description
|
100
|
+
@mh[:description] = true
|
101
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
102
|
+
assert_equal "missing value for tag 'description'", error.message
|
103
|
+
|
104
|
+
@mh[:description] = "hello\nworld"
|
105
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
106
|
+
assert_equal "tag 'description' must be singleline", error.message
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_about
|
110
|
+
@mh[:about] = true
|
111
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
112
|
+
assert_equal "missing value for tag 'about'", error.message
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_screenshot
|
116
|
+
@mh[:screenshot] = true
|
117
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
118
|
+
assert_equal "missing value for tag 'screenshot'", error.message
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_donation
|
122
|
+
@mh[:donation] = true
|
123
|
+
error = assert_raises(ReaPack::Index::Error) { @scanner.run }
|
124
|
+
assert_equal "missing value for tag 'donation'", error.message
|
125
|
+
end
|
126
|
+
end
|