Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve handling of escaped strings with String.Format #262

Open
Fryguy opened this issue Aug 12, 2024 · 0 comments
Open

Improve handling of escaped strings with String.Format #262

Fryguy opened this issue Aug 12, 2024 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@Fryguy
Copy link
Member

Fryguy commented Aug 12, 2024

String.Format doesn't handle string with escaped characters properly. There are some pending specs committed demonstrating the problems, namely

  • it "with args with escaped characters" do
    pending "better handling of escaped characters in the template"
    result = described_class.value("States.Format('This value is {}', '\\'')")
    expect(result).to eq("This value is \\'")
    end
  • it "fails with invalid templates" do
    pending "better handling of escaped characters in the template"
    expect { described_class.value("States.Format('\\{}')") }.to raise_error(ArgumentError, "Invalid template in States.Format (matching '{' not found for '}')")
    expect { described_class.value("States.Format('{\\}')") }.to raise_error(ArgumentError, "Invalid template in States.Format (matching '}' not found for '{')")
    end
@Fryguy Fryguy added bug Something isn't working help wanted Extra attention is needed labels Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant