Skip to content

Commit

Permalink
#27 Add missing hex validation
Browse files Browse the repository at this point in the history
  • Loading branch information
greeneca committed Jan 8, 2019
1 parent 5d75f32 commit 1ef3596
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG
@@ -1,3 +1,8 @@
= 4.11.4 =

- Allow leading zeros on manifest integers
- Add missing hex manifest validation

= 4.11.3 =

- Fix syntax error
Expand Down
4 changes: 4 additions & 0 deletions lib/roku_builder/plugins/manifest_inspector.rb
Expand Up @@ -49,6 +49,10 @@ def run(inspector_config)
unless "%0#{@attributes[key].length}i" % @attributes[key].to_i == @attributes[key]
add_warning(warning: :manifestInvalidValue, key: key)
end
when :hex
unless @attributes[key][0] == "#" and !@attributes[key][1..-1][/\H/]
add_warning(warning: :manifestInvalidValue, key: key)
end
when :float
unless @attributes[key].to_f.to_s == @attributes[key]
add_warning(warning: :manifestInvalidValue, key: key)
Expand Down
2 changes: 1 addition & 1 deletion lib/roku_builder/version.rb
Expand Up @@ -2,5 +2,5 @@

module RokuBuilder
# Version of the RokuBuilder Gem
VERSION = "4.11.3"
VERSION = "4.11.4"
end
8 changes: 8 additions & 0 deletions test/roku_builder/plugins/test_analyzer.rb
Expand Up @@ -70,6 +70,14 @@ def test_manifest_invalid_value_integer
assert_equal 2, warnings[0][:line]
assert_equal "manifest", warnings[0][:path]
end
def test_manifest_invalid_value_hex
warnings = test_manifest("manifest_invalid_value_hex")
assert_equal 1, warnings.count
assert_match(/splash_color/, warnings[0][:message])
assert_match(/bad/, warnings[0][:message])
assert_equal 9, warnings[0][:line]
assert_equal "manifest", warnings[0][:path]
end
def test_manifest_invalid_value_float
warnings = test_manifest("manifest_invalid_value_float")
assert_equal 1, warnings.count
Expand Down
@@ -0,0 +1,9 @@
title=Test
major_version=1
minor_version=0
build_version=01
mm_icon_focus_hd=pkg:/images/focus_hd.png
mm_icon_focus_sd=pkg:/images/focus_sd.png
splash_screen_hd=pkg:/images/splash_hd.png
splash_screen_sd=pkg:/images/splash_sd.png
splash_color=bad
Expand Up @@ -6,3 +6,4 @@ mm_icon_focus_hd=pkg:/images/focus_hd.png
mm_icon_focus_sd=pkg:/images/focus_sd.png
splash_screen_hd=pkg:/images/splash_hd.png
splash_screen_sd=pkg:/images/splash_sd.png
splash_color=#121212

0 comments on commit 1ef3596

Please sign in to comment.