Sha256: 4cbd029e7557ed4266936cf0f206312654ded69ce8dd820828a87238c70b9a5c
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
# coding: utf-8 $:.unshift "." require File.join(File.dirname(__FILE__), 'spec_helper') require 'rdf_context/string_hacks' describe String do { "Gregg" => 'Gregg', "Dürst" => 'D\u00FCrst', "simple literal" => 'simple literal', "backslash:\\" => 'backslash:\\\\', "dquote:\"" => 'dquote:\\"', "newline:\n" => 'newline:\\n', "return:\r" => 'return:\\r', "tab:\t" => 'tab:\\t', }.each_pair do |raw, encoded| specify "'#{raw}' should escape to '#{encoded}'" do raw.rdf_escape.should == encoded end specify "'#{encoded}' should unescape to '#{raw}'" do encoded.rdf_unescape.should == raw end end # 16-bit string encodings { "16-bit:\u{15678}another" => '16-bit:\\U00015678another', }.each_pair do |raw, encoded| specify "'#{raw}' should escape to '#{encoded}'" do raw.rdf_escape.should == encoded end specify "'#{encoded}' should unescape to '#{raw}'" do encoded.rdf_unescape.should == raw end end if defined?(::Encoding) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rdf_context-0.5.11 | spec/string_hacks_spec.rb |
rdf_context-0.5.10 | spec/string_hacks_spec.rb |