package TestCase::Lib::SPVM::HTTP::URL::Escape {
  use SPVM::HTTP::URL::Escape;

  sub test_escape : int () {
    my $raw_string = "尾骶骨𠮷 🤔";
    my $expected_escaped = "%E5%B0%BE%E9%AA%B6%E9%AA%A8%F0%A0%AE%B7%20%F0%9F%A4%94";
    my $got_escaped = SPVM::HTTP::URL::Escape->escape($raw_string);
    unless ($got_escaped eq $expected_escaped) {
      warn("got_escaped: $got_escaped");
      warn("expected_escaped: $expected_escaped");
      return 0;
    }
    my $got_unescaped = SPVM::HTTP::URL::Escape->unescape($got_escaped);
    unless ($got_unescaped eq $raw_string) {
      warn("got_unescaped: $got_unescaped");
      warn("raw_string: $raw_string");
      return 0;
    }
    return 1;
  }
}
