diff --git a/lib/licensee/matchers/cargo.rb b/lib/licensee/matchers/cargo.rb index ce41f4fc..36c70dbd 100644 --- a/lib/licensee/matchers/cargo.rb +++ b/lib/licensee/matchers/cargo.rb @@ -2,7 +2,7 @@ module Licensee module Matchers class Cargo < Licensee::Matchers::Package LICENSE_REGEX = %r{ - ^\s*[\'\"]?license[\'\"]?\s*=\s*[\'\"]([a-z\-0-9\.+\/]+)[\'\"]\s* + ^\s*[\'\"]?license[\'\"]?\s*=\s*[\'\"]([a-z\-0-9\. +()\/]+)[\'\"]\s* }ix private diff --git a/spec/licensee/matchers/cargo_matcher_spec.rb b/spec/licensee/matchers/cargo_matcher_spec.rb index 04dedca1..de421e8c 100644 --- a/spec/licensee/matchers/cargo_matcher_spec.rb +++ b/spec/licensee/matchers/cargo_matcher_spec.rb @@ -17,14 +17,16 @@ end { - 'spdx name' => ['license = "MIT"', 'mit'], - 'single quotes' => ["license = 'mit'", 'mit'], - 'quoted key' => ["'license' = 'mit'", 'mit'], - 'double quoted key' => ['"license"="mit"', 'mit'], - 'no whitespace' => ["license='mit'", 'mit'], - 'leading whitespace' => [" license = 'mit'", 'mit'], - 'other license' => ['license = "Foo"', 'other'], - 'multiple licenses' => ['license = "Apache-2.0/MIT"', 'other'] + 'spdx name' => ['license = "MIT"', 'mit'], + 'single quotes' => ["license = 'mit'", 'mit'], + 'quoted key' => ["'license' = 'mit'", 'mit'], + 'double quoted key' => ['"license"="mit"', 'mit'], + 'no whitespace' => ["license='mit'", 'mit'], + 'leading whitespace' => [" license = 'mit'", 'mit'], + 'other license' => ['license = "Foo"', 'other'], + 'multiple licenses /' => ['license = "Apache-2.0/MIT"', 'other'], + 'multiple licenses OR' => ['license = "Apache-2.0 OR MIT"', 'other'], + 'multiple licenses parens' => ['license = "(Apache-2.0 OR MIT)"', 'other'] }.each do |description, license_declaration_and_key| context "with a #{description}" do let(:content) { license_declaration_and_key[0] }