File: platform_spec.rb

package info (click to toggle)
ruby-ffi 1.9.6debian-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,376 kB
  • ctags: 2,126
  • sloc: ansic: 7,471; ruby: 5,585; sh: 24; makefile: 14
file content (114 lines) | stat: -rw-r--r-- 2,430 bytes parent folder | download | duplicates (4)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#
# This file is part of ruby-ffi.
# For licensing, see LICENSE.SPECS
#

require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))

describe "FFI::Platform::LIBSUFFIX" do
  case OS
  when "linux"
    it "returns 'so'" do
      expect(FFI::Platform::LIBSUFFIX).to eq('so')
    end
  when "windows"
    it "returns 'dll'" do
      expect(FFI::Platform::LIBSUFFIX).to eq('dll')
    end
  when "darwin"
    it "returns 'dylib'" do
      expect(FFI::Platform::LIBSUFFIX).to eq('dylib')
    end
  end
end

describe "FFI::Platform::IS_WINDOWS" do
  case OS
  when "linux"
    it "returns false" do
      expect(FFI::Platform::IS_WINDOWS).to be false
    end
  when "windows"
    it "returns true" do
      expect(FFI::Platform::IS_WINDOWS).to be true
    end
  when "darwin"
    it "returns false" do
      expect(FFI::Platform::IS_WINDOWS).to be false
    end
  end
end

describe "FFI::Platform::ARCH" do
  it "returns the architecture type" do
    expect(FFI::Platform::ARCH).to eq(CPU)
  end
end

describe "FFI::Platform::OS" do
  case OS
  when "linux"
    it "returns 'linux' as a string" do
      expect(FFI::Platform::OS).to eq('linux')
    end
  when "windows"
    it "returns 'windows' as a string" do
      expect(FFI::Platform::OS).to eq('windows')
    end
  when "darwin"
    it "returns 'darwin' as a string" do
      expect(FFI::Platform::OS).to eq('darwin')
    end
  end
end

describe "FFI::Platform.windows?" do
  case OS
  when "linux"
    it "returns false" do
      expect(FFI::Platform.windows?).to be false
    end
  when "windows"
    it "returns true" do
      expect(FFI::Platform.windows?).to be true
    end
  when "darwin"
    it "returns false" do
      expect(FFI::Platform.windows?).to be false
    end
  end
end

describe "FFI::Platform.mac?" do
  case OS
  when "linux"
    it "returns false" do
      expect(FFI::Platform.mac?).to be false
    end
  when "windows"
    it "returns false" do
      expect(FFI::Platform.mac?).to be false
    end
  when "darwin"
    it "returns true" do
      expect(FFI::Platform.mac?).to be true
    end
  end
end

describe "FFI::Platform.unix?" do
  case OS
  when "linux"
    it "returns true" do
      expect(FFI::Platform.unix?).to be true
    end
  when "windows"
    it "returns false" do
      expect(FFI::Platform.unix?).to be false
    end
  when "darwin"
    it "returns true" do
      expect(FFI::Platform.unix?).to be true
    end
  end
end