-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Idea mentioned in https://trello.com/c/uTPysoYP/15-find-useful-calls-producing-niceness
- Loading branch information
Showing
3 changed files
with
43 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Feature: sformat | ||
|
||
Builtins.sformat results in a nice value that even if the input is ugly! | ||
Well, it does return nil if the format argument is nil, but | ||
that can be checked, and mostly we will see string literal formats. | ||
|
||
Scenario: translates `Ops.add` of a literal and a regular sformat | ||
Given the original code is | ||
""" | ||
Ops.add("nice", Builtins.sformat("%1", nil)) | ||
""" | ||
When the cop Yast/Ops autocorrects it | ||
Then the code is converted to | ||
""" | ||
"nice" + Builtins.sformat("%1", nil) | ||
""" | ||
|
||
Scenario: doesn't translate `Ops.add` of a literal and a ugly sformat | ||
Given the original code is | ||
""" | ||
Ops.add("nice", Builtins.sformat(ugly, nil)) | ||
""" | ||
When the cop Yast/Ops autocorrects it | ||
Then the code is unchanged |
This file contains 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
This file contains 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