File: path_character_device_test.rb

package info (click to toggle)
ruby-train 3.13.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,208 kB
  • sloc: ruby: 10,002; sh: 17; makefile: 8
file content (72 lines) | stat: -rw-r--r-- 1,640 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
describe "file interface" do
  let(:backend) { get_backend.call }

  describe "character device" do
    let(:file) { backend.file("/dev/null") }

    it "exists" do
      _(file.exist?).must_equal(true)
    end

    it "is a character device" do
      _(file.character_device?).must_equal(true)
    end

    it "has type :character_device" do
      _(file.type).must_equal(:character_device)
    end

    it "has empty content" do
      _(file.content).must_equal("")
    end

    it "has owner name root" do
      _(file.owner).must_equal("root")
    end

    it "has group name" do
      _(file.group).must_equal(Test.root_group(backend.os))
    end

    it "has mode 0666" do
      _(file.mode).must_equal(00666)
    end

    it "checks mode? 0666" do
      _(file.mode?(00666)).must_equal(true)
    end

    it "has no link_path" do
      _(file.link_path).must_be_nil
    end

    it "has an md5sum" do
      _(file.md5sum).must_equal("d41d8cd98f00b204e9800998ecf8427e")
    end

    it "has an sha256sum" do
      _(file.sha256sum).must_equal("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
    end

    it "has a modified time" do
      _(file.mtime).must_be_close_to(Time.now.to_i - Test.mtime / 2, Test.mtime)
    end

    it "has inode size of 0" do
      _(file.size).must_equal(0)
    end

    it "has selinux label handling" do
      res = Test.selinux_label(backend, file.path)
      _(file.selinux_label).must_equal(res)
    end

    it "has no product_version" do
      _(file.product_version).must_be_nil
    end

    it "has no file_version" do
      _(file.file_version).must_be_nil
    end
  end
end