Skip to content

Commit 5118de7

Browse files
author
Patrick Kinkeldei
committed
test: added e2e test for bom issue
1 parent fac79d4 commit 5118de7

File tree

6 files changed

+51
-0
lines changed

6 files changed

+51
-0
lines changed

tests/bom_issue/headerless_bom.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace Some.Fake.Namespace;
4+
5+
public class SomeFakeClass
6+
{
7+
public void SomeFakeMethod()
8+
{
9+
Console.WriteLine("Hello, World!");
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -------------------------------------------------------
2+
// Static Copyright
3+
// -------------------------------------------------------
4+
5+
using System;
6+
7+
namespace Some.Fake.Namespace;
8+
9+
public class SomeFakeClass
10+
{
11+
public void SomeFakeMethod()
12+
{
13+
Console.WriteLine("Hello, World!");
14+
}
15+
}

tests/bom_issue/license.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Static Copyright

tests/bom_issue/licenserc.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
baseDir = "."
2+
headerPath = "license.txt"
3+
4+
excludes = ["*.toml", "*.expected"]
5+
6+
additionalHeaders = [
7+
"style.toml"
8+
]
9+
10+
[mapping.HASH_SOURCE_STYLE]
11+
extensions = ["cs"]

tests/bom_issue/style.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[HASH_SOURCE_STYLE]
2+
firstLine = "// -------------------------------------------------------"
3+
endLine = "// -------------------------------------------------------\n"
4+
skipLinePattern = "^#!.*$"
5+
allowBlankLines = false
6+
multipleLines = false
7+
beforeEachLine = "// "
8+
firstLineDetectionPattern = "//\\s+\\-+"
9+
lastLineDetectionPattern = "//\\s+\\-+"

tests/it.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ def diff_files(file1, file2):
3838

3939
subprocess.run([hawkeye, "format", "--fail-if-unknown", "--fail-if-updated=false", "--dry-run"], cwd=(basedir / "regression_blank_line"), check=True)
4040
diff_files(basedir / "regression_blank_line" / "main.rs.expected", basedir / "regression_blank_line" / "main.rs.formatted")
41+
42+
# adds a copyright header to a utf-8 with bom encoded file. The header is inserted before the bom. Which moves the bom behing the added copyright header
43+
subprocess.run([hawkeye, "format", "--fail-if-unknown", "--fail-if-updated=false", "--dry-run"], cwd=(basedir / "bom_issue"), check=True)
44+
diff_files(basedir / "bom_issue" / "headerless_bom.cs.expected", basedir / "bom_issue" / "headerless_bom.cs")

0 commit comments

Comments
 (0)