aboutsummaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'testdata')
-rw-r--r--testdata/Apply_test.txt7
-rw-r--r--testdata/loadConfig/config_exists/spdxconv.cfg46
-rw-r--r--testdata/scan/spdxconv.cfg11
-rw-r--r--testdata/scan/test.html8
4 files changed, 63 insertions, 9 deletions
diff --git a/testdata/Apply_test.txt b/testdata/Apply_test.txt
index 123dc28..8107ee8 100644
--- a/testdata/Apply_test.txt
+++ b/testdata/Apply_test.txt
@@ -50,10 +50,12 @@ pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|
[match-license]
pattern = "^(//+|#+|/\\*+|<!--+)?\\s*(.*)governed by a BSD-style(.*)$"
license_identifier = BSD-3-Clause
-delete_line_pattern = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$"
+delete_line_after = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$"
+delete_line_after = "^(//+|#+|\\*+/|--+>)$"
[match-copyright]
pattern = "^(//+|#+|/\\*+|<!--+)?\\s*Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<(?<contact>.*)>.*$"
+delete_line_before = "^(//+|#+|/\\*+|<!--+)$"
>>> without_spdx_license_id.go
1
@@ -176,9 +178,6 @@ license that can be found in the LICENSE file.
<<< with.html
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<!-- SPDX-FileCopyrightText: 2022 Shulhan <ms@kilabit.info> -->
-<!--
-
--->
1
2
diff --git a/testdata/loadConfig/config_exists/spdxconv.cfg b/testdata/loadConfig/config_exists/spdxconv.cfg
index ec401a3..1f7ff68 100644
--- a/testdata/loadConfig/config_exists/spdxconv.cfg
+++ b/testdata/loadConfig/config_exists/spdxconv.cfg
@@ -3,13 +3,53 @@
[default]
license_identifier = GPL-3.0-only
+copyright_year = 2026
file_copyright_text = Author <contact@email.local>
max_line_match = 10
+[match-file-comment]
+pattern = "^.*\\.(adoc|asciidoc|c|cc|cpp|cs|dart|go|h|hh|hpp|java|js|jsx|jsonc|kt|kts|php|rs|sass|scss|swift|ts|tsx)$"
+prefix = "//"
+
+[match-file-comment]
+pattern = "^.*\\.(aff|bash|csh|dockerfile|env|gitignore|hcl|ipynb|make|pl|pm|py|ps1|rb|sh|tf|yaml|yml|zsh)$"
+prefix = "#"
+
+[match-file-comment]
+pattern = "^.*\\.(css)$"
+prefix = "/*"
+suffix = "*/"
+
+[match-file-comment]
+pattern = "^.*\\.(fxml|htm|html|html5|kml|markdown|md|xml)$"
+prefix = "<!--"
+suffix = "-->"
+
+[match-file-comment]
+pattern = "^.*\\.(lua|sql)$"
+prefix = "--"
+
+[match-file-comment]
+pattern = "^.*\\.(rst)$"
+prefix = ".."
+
+[match-file-comment]
+pattern = "^.*\\.(tex)$"
+prefix = "%"
+
+# File name that match with this pattern will have the ".license" file
+# created.
+[match-file-comment]
+pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$"
+
[match-license]
-pattern = "^(//+|#+)\\s+(.*)governed by a BSD-style(.*)$"
+pattern = "^(//+|#+|/\\*+|<!--+)?\\s*(.*)governed by a BSD-style(.*)$"
license_identifier = BSD-3-Clause
-delete_line_pattern = "^(//+|#+)\\s+license that(.*)$"
+delete_line_before = "^(//+|#+|/\\*+|<!--+)$"
+delete_line_after = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$"
+delete_line_after = "^(//+|#+|\\*+/|--+>)$"
[match-copyright]
-pattern = "^(//+|#+)\\s+Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<*(?<contact>.*)>.*$"
+pattern = "^(//+|#+|/\\*+|<!--+)?\\s*Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<(?<contact>.*)>.*$"
+delete_line_before = "^(//+|#+|/\\*+|<!--+)$"
+delete_line_after = "^(//+|#+|\\*+/|--+>)$"
diff --git a/testdata/scan/spdxconv.cfg b/testdata/scan/spdxconv.cfg
index 3b137b6..1cdfefb 100644
--- a/testdata/scan/spdxconv.cfg
+++ b/testdata/scan/spdxconv.cfg
@@ -42,10 +42,19 @@ prefix = "%"
[match-file-comment]
pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$"
+# File name that match with this pattern will have the ".license" file
+# created.
+[match-file-comment]
+pattern = "^.*\\.(apk|app|bz2|csv|doc|docx|exe|gif|gz|jpeg|jpg|json|pdf|png|ppt|pptx|svg|svgz|tar|tgz|xls|xlsx|zip)$"
+
[match-license]
pattern = "^(//+|#+|/\\*+|<!--+)?\\s*(.*)governed by a BSD-style(.*)$"
license_identifier = BSD-3-Clause
-delete_line_pattern = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$"
+delete_line_before = "^(//+|#+|/\\*+|<!--+)$"
+delete_line_after = "^(//+|#+|/\\*+|<!--+)?\\s*license that can(.*)$"
+delete_line_after = "^(//+|#+|\\*+/|--+>)$"
[match-copyright]
pattern = "^(//+|#+|/\\*+|<!--+)?\\s*Copyright\\s+(?<year>\\d{4}),?\\s+(?<author>.*)\\s+<(?<contact>.*)>.*$"
+delete_line_before = "^(//+|#+|/\\*+|<!--+)$"
+delete_line_after = "^(//+|#+|\\*+/|--+>)$"
diff --git a/testdata/scan/test.html b/testdata/scan/test.html
index da2491e..bcfc0c3 100644
--- a/testdata/scan/test.html
+++ b/testdata/scan/test.html
@@ -1,5 +1,11 @@
<!--
Copyright 2022, Shulhan <ms@kilabit.info>. All rights reserved.
+-->
+<!--
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
---> \ No newline at end of file
+-->
+
+1
+2
+3