From cf930418cb0a07ff4cf3de76a5536f36d07eac2f Mon Sep 17 00:00:00 2001 From: Alex Ling Date: Wed, 30 Dec 2020 12:50:14 +0000 Subject: [PATCH] Update rename spec --- spec/rename_spec.cr | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/rename_spec.cr b/spec/rename_spec.cr index c830581..65afdf9 100644 --- a/spec/rename_spec.cr +++ b/spec/rename_spec.cr @@ -40,11 +40,6 @@ describe Rule do rule.render({"a" => "a", "b" => "b"}).should eq "a" end - it "allows `|` outside of patterns" do - rule = Rule.new "hello|world" - rule.render({} of String => String).should eq "hello|world" - end - it "raises on escaped characters" do expect_raises Exception do Rule.new "hello/world" @@ -69,8 +64,13 @@ describe Rule do rule.render({} of String => String).should eq "testing" end - it "escapes slash" do - rule = Rule.new "{id}" - rule.render({"id" => "/hello/world"}).should eq "_hello_world" + it "escapes illegal characters" do + rule = Rule.new "{a}" + rule.render({"a" => "/?<>:*|\"^"}).should eq "_________" + end + + it "strips trailing spaces and dots" do + rule = Rule.new "hello. world. .." + rule.render({} of String => String).should eq "hello. world" end end