Skip to content

Improve handling of escaped strings with String.Format #262

@Fryguy

Description

@Fryguy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions