Skip to content

Commit

Permalink
Merge pull request #261 from spdx/issue260
Browse files Browse the repository at this point in the history
Resolve issue #260 - matching (c)
  • Loading branch information
goneall authored Oct 25, 2020
2 parents 17b6f86 + 1a0086d commit 9f4f8c5
Show file tree
Hide file tree
Showing 4 changed files with 735 additions and 46 deletions.
13 changes: 12 additions & 1 deletion Test/org/spdx/compare/LicenseCompareHelperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.spdx.rdfparser.license.DisjunctiveLicenseSet;
import org.spdx.rdfparser.license.ExtractedLicenseInfo;
import org.spdx.rdfparser.license.LicenseInfoFactory;
import org.spdx.rdfparser.license.ListedLicenses;
import org.spdx.rdfparser.license.SpdxListedLicense;
import org.spdx.rdfparser.license.SpdxNoAssertionLicense;
import org.spdx.rdfparser.license.SpdxNoneLicense;
Expand All @@ -56,6 +57,7 @@ public class LicenseCompareHelperTest {
static final String AGPL_3_ONLY = "TestFiles" + File.separator + "AGPL-3.0-only.txt";
static final String ISC_TEMPLATE = "TestFiles" + File.separator + "ISC.template.txt";
static final String ISC = "TestFiles" + File.separator + "ISC.txt";
static final String GPL_3_TEXT = "TestFiles" + File.separator + "GPL-3.0-test.txt";
/**
* @throws java.lang.Exception
*/
Expand Down Expand Up @@ -617,6 +619,14 @@ public void testMatchingStandardLicenseIds() throws IOException, InvalidSPDXAnal
// assertTrue(result[0].startsWith("GPL-2"));
// assertTrue(result[1].startsWith("GPL-2"));
}

@Test
public void testIsTextStandardLicenseGpl3() throws InvalidSPDXAnalysisException, SpdxCompareException, IOException {
SpdxListedLicense gpl3 = ListedLicenses.getListedLicenses().getListedLicenseById("GPL-3.0");
String compareText = UnitTestHelper.fileToText(GPL_3_TEXT);
DifferenceDescription result = LicenseCompareHelper.isTextStandardLicense(gpl3, compareText);
assertFalse(result.isDifferenceFound());
}

@Test
public void testFirstLicenseToken() {
Expand Down Expand Up @@ -684,6 +694,7 @@ public void testNonOptionalTextToStartPattern() throws SpdxCompareException, IOE
assertTrue(matcher.find());
license = new SpdxListedLicense("ISC", "ISC", "", new String[] {},
"", "", iscTempalte, false, false);
assertFalse(LicenseCompareHelper.isTextStandardLicense(license, testText.substring(matcher.start(), matcher.end())).isDifferenceFound());
DifferenceDescription diff = LicenseCompareHelper.isTextStandardLicense(license, testText.substring(matcher.start(), matcher.end()));
assertFalse(diff.isDifferenceFound());
}
}
Loading

0 comments on commit 9f4f8c5

Please sign in to comment.