feat: add T command (branch on no-substitution)#448
Open
MukundaKatta wants to merge 2 commits into
Open
Conversation
Implements the GNU `T LABEL` command: branch to LABEL if no s/// substitution has succeeded since the last input line was read or the last t/T was taken. It is the inverse of `t` and shares the same address and label parsing. Wires 'T' into get_cmd_spec, resolve_branch_targets, and the processor branch logic, resetting the substitution flag on evaluation just like 't'. Adds integration tests (simple branch + flag-clear) and a cmd-spec unit test. Closes uutils#395
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #448 +/- ##
==========================================
- Coverage 82.20% 82.13% -0.08%
==========================================
Files 13 13
Lines 5542 5559 +17
Branches 310 312 +2
==========================================
+ Hits 4556 4566 +10
- Misses 983 990 +7
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the GNU
T LABELcommand (issue #395): branch toLABELif nos///substitution has succeeded since the last input line was read or the lastt/Twas taken. It is the inverse oft.Before:
After:
Implementation
get_cmd_spec: acceptTalongsideb/t(2 addresses,compile_label_command). Label parsing is already code-agnostic.resolve_branch_targets: includeTwhen convertingLabel->BranchTarget.Tbranches when!substitution_made; in both the branch and no-branch arms the flag is reset on evaluation, matchingt.Testing
cargo test: full suite green (282 unit + 183 integration).cargo clippy --all-targets -- -D warningsandcargo fmt --check: clean.branch_no_sub_simple(selective branch) andbranch_no_sub_clears(provesTclears the substitution flag) integration tests, plus aget_cmd_specunit test coveringb/t/T.Closes #395