mirror of
https://tulpa.dev/cadey/gitea-release
synced 2025-10-06 01:52:59 +02:00
support bracketed version numbers
This commit is contained in:
@@ -24,7 +24,7 @@ pub(crate) fn read(fname: PathBuf, tag: String) -> Result<String> {
|
||||
|
||||
let found_tag = String::from_utf8(nd.content.clone())?;
|
||||
|
||||
if found_tag == tag {
|
||||
if found_tag == tag || found_tag == format!("[{}]", tag) {
|
||||
collect = true;
|
||||
}
|
||||
} else {
|
||||
@@ -70,7 +70,7 @@ where
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn read_changelog() {
|
||||
fn basic() {
|
||||
let res = super::read("testdata/basic.md".into(), "0.1.0".into());
|
||||
assert!(res.is_ok());
|
||||
let delta = res.unwrap();
|
||||
@@ -79,4 +79,15 @@ mod tests {
|
||||
"Hi there this is a test\\!\n### ADDED\n - something\n"
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn brackets() {
|
||||
let res = super::read("testdata/brackets.md".into(), "0.1.0".into());
|
||||
assert!(res.is_ok());
|
||||
let delta = res.unwrap();
|
||||
assert_eq!(
|
||||
delta,
|
||||
"Hi there this is a test\\!\n### ADDED\n - something\n"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
4
testdata/brackets.md
vendored
Normal file
4
testdata/brackets.md
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
## [0.1.0]
|
||||
Hi there this is a test!
|
||||
### ADDED
|
||||
- something
|
Reference in New Issue
Block a user