Format exported variadic parameters correctly (#1451)
This commit is contained in:
parent
1119d226fe
commit
79dba579f7
@ -15,12 +15,12 @@ pub(crate) struct Parameter<'src> {
|
||||
|
||||
impl<'src> ColorDisplay for Parameter<'src> {
|
||||
fn fmt(&self, f: &mut Formatter, color: Color) -> Result<(), fmt::Error> {
|
||||
if self.export {
|
||||
write!(f, "$")?;
|
||||
}
|
||||
if let Some(prefix) = self.kind.prefix() {
|
||||
write!(f, "{}", color.annotation().paint(prefix))?;
|
||||
}
|
||||
if self.export {
|
||||
write!(f, "$")?;
|
||||
}
|
||||
write!(f, "{}", color.parameter().paint(self.name.lexeme()))?;
|
||||
if let Some(ref default) = self.default {
|
||||
write!(f, "={}", color.string().paint(&default.to_string()))?;
|
||||
|
@ -1042,3 +1042,12 @@ test! {
|
||||
echo foo
|
||||
",
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn exported_parameter() {
|
||||
Test::new()
|
||||
.justfile("foo +$f:")
|
||||
.args(&["--dump"])
|
||||
.stdout("foo +$f:\n")
|
||||
.run();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user