Skip to content

Commit 96c9187

Browse files
committed
Add unit test for X-11 license match
Added to see if the library is the cause of spdx/spdx-online-tools#540 Signed-off-by: Gary O'Neall <[email protected]>
1 parent 7fd2435 commit 96c9187

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

TestFiles/x-11-pthreads.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Permission is hereby granted, free of charge, to any person obtaining a
2+
copy of this software and associated documentation files (the "Software"),
3+
to deal in the Software without restriction, including without limitation
4+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
5+
and/or sell copies of the Software, and to permit persons to whom the
6+
Software is furnished to do so, subject to the following conditions:
7+
8+
The above copyright notice and this permission notice shall be included in
9+
all copies or substantial portions of the Software.
10+
11+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14+
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17+
18+
Except as contained in this notice, the names of the authors or their
19+
institutions shall not be used in advertising or otherwise to promote the
20+
sale, use or other dealings in this Software without prior written
21+
authorization from the authors.

src/test/java/org/spdx/utility/compare/LicenseCompareHelperTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public class LicenseCompareHelperTest extends TestCase {
101101
static final String GPL_2_NL = "TestFiles" + File.separator + "GPL-2.0-NL.txt";
102102
static final String GPL_2_TEMPLATE = "TestFiles" + File.separator + "GPL-2.0-only.template.txt";
103103
static final String IMAGE_MAGIK_TEMPLATE = "TestFiles" + File.separator + "ImageMagick.template.txt";
104+
static final String X_11_PTHREADS = "TestFiles" + File.separator + "x-11-pthreads.txt";
104105

105106
IModelStore modelStore;
106107
IModelCopyManager copyManager;
@@ -989,4 +990,12 @@ public void testAPIConsistency() throws InvalidSPDXAnalysisException, SpdxCompar
989990
assertAPIConsistency("MPL-2.0", UnitTestHelper.fileToText(MPL_2_FROM_MOZILLA_FILE));
990991
}
991992
}
993+
994+
public void testX11Pthreads() throws InvalidSPDXAnalysisException, SpdxCompareException, IOException {
995+
String licText = UnitTestHelper.fileToText(X_11_PTHREADS);
996+
String[] result = LicenseCompareHelper.matchingStandardLicenseIds(licText);
997+
assertEquals(0, result.length);
998+
ListedLicense license = ListedLicenses.getListedLicenses().getListedLicenseById("X11-distribute-modifications-variant");
999+
assertTrue(LicenseCompareHelper.isTextStandardLicense(license, licText).isDifferenceFound());
1000+
}
9921001
}

0 commit comments

Comments
 (0)