Skip to content

Commit

Permalink
[147] Dump backslashed keys
Browse files Browse the repository at this point in the history
  • Loading branch information
emancu committed Jan 7, 2024
1 parent 3e73482 commit 5883615
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/dumper_test.rb
Expand Up @@ -108,18 +108,35 @@ def test_dump_array_tables
def test_dump_interpolation_curly
hash = {"key" => "includes \#{variable}"}
dumped = TomlRB.dump(hash)

assert_equal %(key = "includes \#{variable}") + "\n", dumped
end

def test_dump_interpolation_at
hash = {"key" => 'includes #@variable'}
dumped = TomlRB.dump(hash)

assert_equal 'key = "includes #@variable"' + "\n", dumped
end

def test_dump_interpolation_dollar
hash = {"key" => 'includes #$variable'}
dumped = TomlRB.dump(hash)

assert_equal 'key = "includes #$variable"' + "\n", dumped
end

def test_dump_special_chars_in_literals
hash = {'\t' => "escape special chars in string literals"}
dumped = TomlRB.dump(hash)

assert_equal %("\\t" = "escape special chars in string literals") + "\n", dumped
end

def test_dump_special_chars_in_strings
hash = {"\t" => "escape special chars in strings"}
dumped = TomlRB.dump(hash)

assert_equal %("\t" = "escape special chars in strings") + "\n", dumped
end
end

0 comments on commit 5883615

Please sign in to comment.