Skip to content

Commit

Permalink
test: add test for hawkeye.core.filename property
Browse files Browse the repository at this point in the history
This closes #113.

Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Jan 17, 2024
1 parent 1d1eb79 commit fb65030
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions hawkeye-core/src/test/data/issue-113/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
main.rs.formatted
17 changes: 17 additions & 0 deletions hawkeye-core/src/test/data/issue-113/licenserc.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
baseDir = "src/test/data/issue-113"

inlineHeader = """
${hawkeye.core.filename}
------------------------------------------
Copyright (c) ${year}
${owner}
------------------------------------------
"""

includes = [
"*.rs",
]

[properties]
year = 2024
owner = "Some_Name"
1 change: 1 addition & 0 deletions hawkeye-core/src/test/data/issue-113/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use macros::define_result;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// main.rs
// ------------------------------------------
// Copyright (c) 2024
// Some_Name
// ------------------------------------------

use macros::define_result;
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,16 @@ void testIssue110() {
final File actual = new File("src/test/data/issue-110/main.rs.formatted");
assertThat(actual).hasSameTextualContentAs(expected);
}

@Test
void testIssue113() {
final File file = new File("src/test/data/issue-113/licenserc.toml");
final HawkEyeConfig config = HawkEyeConfig.of(file).dryRun(true).build();
final LicenseFormatter formatter = new LicenseFormatter(config);
formatter.call();

final File expected = new File("src/test/data/issue-113/main.rs.formatted.expected");
final File actual = new File("src/test/data/issue-113/main.rs.formatted");
assertThat(actual).hasSameTextualContentAs(expected);
}
}

0 comments on commit fb65030

Please sign in to comment.