File: lib.rs

package info (click to toggle)
rust-clang-sys 0.27.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 288 kB
  • sloc: sh: 58; ansic: 4; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 819 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
extern crate clang_sys;
extern crate libc;

use std::ptr;

use clang_sys::*;

use libc::{c_char};

fn parse() {
    unsafe {
        let index = clang_createIndex(0, 0);
        assert!(!index.is_null());

        let tu = clang_parseTranslationUnit(
            index,
            "tests/header.h\0".as_ptr() as *const c_char,
            ptr::null_mut(),
            0,
            ptr::null_mut(),
            0,
            0,
        );
        assert!(!tu.is_null());
    }
}

#[cfg(feature="runtime")]
#[test]
fn test() {
    load().unwrap();
    parse();
    unload().unwrap();
}

#[cfg(not(feature="runtime"))]
#[test]
fn test() {
    parse();
}

#[test]
fn test_support() {
    let clang = support::Clang::find(None, &[]).unwrap();
    println!("{:?}", clang);
}