Merge pull request #258 from benbalter/cargo-slash

multiple licenses in Cargo.toml obtains other rather than nil
This commit is contained in:
Mike Linksvayer 2018-01-03 17:48:33 -08:00 committed by GitHub
commit 1264dc9d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,9 @@
module Licensee
module Matchers
class Cargo < Licensee::Matchers::Package
LICENSE_REGEX = /
^\s*[\'\"]?license[\'\"]?\s*=\s*[\'\"]([a-z\-0-9\._]+)[\'\"]\s*
/ix
LICENSE_REGEX = %r{
^\s*[\'\"]?license[\'\"]?\s*=\s*[\'\"]([a-z\-0-9\.+\/]+)[\'\"]\s*
}ix
private

View File

@ -23,7 +23,8 @@ RSpec.describe Licensee::Matchers::Cargo do
'double quoted key' => ['"license"="mit"', 'mit'],
'no whitespace' => ["license='mit'", 'mit'],
'leading whitespace' => [" license = 'mit'", 'mit'],
'other license' => ['license = "Foo"', 'other']
'other license' => ['license = "Foo"', 'other'],
'multiple licenses' => ['license = "Apache-2.0/MIT"', 'other']
}.each do |description, license_declaration_and_key|
context "with a #{description}" do
let(:content) { license_declaration_and_key[0] }