File: test_pstore.rb

package info (click to toggle)
ruby-mini-exiftool 2.9.0-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 688 kB
  • sloc: ruby: 2,616; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# -- encoding: utf-8 --
require 'helpers_for_test'

class TestPstore < TestCase

  def test_pstore
    pstore_dir = Dir.mktmpdir
    s = MiniExiftool.writable_tags.size.to_s
    cmd = %Q(#{RUBY_ENGINE} -EUTF-8 -I lib -r mini_exiftool -e "MiniExiftool.pstore_dir = '#{pstore_dir}'; p MiniExiftool.writable_tags.size")
    a = Time.now
    result = `#{cmd}`
    b = Time.now
    assert_equal s, result.chomp
    assert_equal 1, Dir[File.join(pstore_dir, '*')].size
    c = Time.now
    result = `#{cmd}`
    d = Time.now
    assert_equal s, result.chomp
    assert 10 * (d - c) < (b - a)
  ensure
    FileUtils.rm_rf pstore_dir
  end

end