File: llvm_spec.cr

package info (click to toggle)
crystal 1.14.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 24,384 kB
  • sloc: javascript: 6,400; sh: 695; makefile: 269; ansic: 121; python: 105; cpp: 77; xml: 32
file content (48 lines) | stat: -rw-r--r-- 1,376 bytes parent folder | download
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
require "spec"

{% if flag?(:interpreted) && !flag?(:win32) %}
  # TODO: figure out how to link against libstdc++ in interpreted code (#14398)
  pending LLVM
  {% skip_file %}
{% end %}

require "llvm"

describe LLVM do
  describe ".normalize_triple" do
    it "works" do
      LLVM.normalize_triple("x86_64-apple-macos").should eq("x86_64-apple-macos")
    end

    it "substitutes unknown for empty components" do
      LLVM.normalize_triple("x86_64-linux-gnu").should eq("x86_64-unknown-linux-gnu")
    end
  end

  it ".default_target_triple" do
    triple = LLVM.default_target_triple
    {% if flag?(:darwin) %}
      triple.should match(/-apple-(darwin|macosx)/)
    {% elsif flag?(:android) %}
      triple.should match(/-android$/)
    {% elsif flag?(:linux) %}
      triple.should match(/-linux/)
    {% elsif flag?(:windows) %}
      triple.should match(/-windows-/)
    {% elsif flag?(:freebsd) %}
      triple.should match(/-freebsd/)
    {% elsif flag?(:openbsd) %}
      triple.should match(/-openbsd/)
    {% elsif flag?(:dragonfly) %}
      triple.should match(/-dragonfly/)
    {% elsif flag?(:netbsd) %}
      triple.should match(/-netbsd/)
    {% elsif flag?(:solaris) %}
      triple.should match(/-solaris$/)
    {% elsif flag?(:wasi) %}
      triple.should match(/-wasi/)
    {% else %}
      pending! "Unknown operating system"
    {% end %}
  end
end