Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Jan 17, 2025
1 parent c9c18e3 commit b5cf67a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/elements/command/case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ impl CaseCommand {
if feeder.len() == 0 {
feeder.feed_additional_line(core)?;
}

if feeder.starts_with("esac") {
ans.text += &feeder.consume(4);
esac = true;
break;
}

let mut patterns = vec![];
if ! Self::eat_patterns(feeder, &mut patterns, &mut ans.text, core)? {
break;
Expand Down
1 change: 1 addition & 0 deletions src/elements/command/error
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../../../test/test_compound.bash
10 changes: 10 additions & 0 deletions test/test_compound.bash
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,16 @@ aaa) echo OK ;;
')
[ "$res" = "" ] || err $LINENO

res=$($com <<< '
case xterm-color in
xterm-color|*-256color) color_prompt=yes;;
esac
echo $color_prompt
'
)
[ "$res" = "yes" ] || err $LINENO



res=$($com <<< 'case aaa in aaa) echo OK1 ;;& bbb) echo OK2 ;& aaa) echo OK3 ;; esac')
[ "$res" = "OK1
Expand Down

0 comments on commit b5cf67a

Please sign in to comment.