File: file_test.rb

package info (click to toggle)
ruby-perfect-toml 0.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 224 kB
  • sloc: ruby: 1,929; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 493 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "test_helper"
require "tempfile"

class LoadSaveFileTest < Test::Unit::TestCase
  def test_load_file
    Tempfile.create(["toml-test", ".toml"]) do |t|
      t << "load = 42\n"
      t.close
      assert_equal({ "load" => 42 }, PerfectTOML.load_file(t.path))
    end
  end

  def test_save_file
    Tempfile.create(["toml-test", ".toml"]) do |t|
      t.close
      PerfectTOML.save_file(t.path, { "save" => 42 })
      assert_equal("save = 42\n", File.read(t.path))
    end
  end
end