Skip to content

Commit

Permalink
Merge pull request #57 from librariesio/mellisio/spdx/fix-none-no-ass…
Browse files Browse the repository at this point in the history
…ertion-with-licenses
  • Loading branch information
Matt Ellis authored May 4, 2020
2 parents 9e80cc7 + 94b9c62 commit d3403ea
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/spdx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Spdx
VERSION = "2.0.3"
VERSION = "2.0.4"
end
6 changes: 6 additions & 0 deletions lib/spdx_grammar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ class With < Treetop::Runtime::SyntaxNode
end

class None < Treetop::Runtime::SyntaxNode
def licenses
[]
end
end

class NoAssertion < Treetop::Runtime::SyntaxNode
def licenses
[]
end
end

class License < Treetop::Runtime::SyntaxNode
Expand Down
9 changes: 9 additions & 0 deletions spec/spdx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,13 @@
expect(Spdx.alias_exists?("FAKEALIAS")).to be false
end
end
context "licenses" do
it "returns a list of possible licenses" do
expect(Spdx.parse_spdx("MIT OR MPL-2.0").licenses).to eq ["MIT", "MPL-2.0"]
end
it "returns empty array for NONE or NOASSERTION" do
expect(Spdx.parse_spdx("NONE").licenses).to eq []
expect(Spdx.parse_spdx("NOASSERTION").licenses).to eq []
end
end
end

0 comments on commit d3403ea

Please sign in to comment.