File: 06-diagnostic.t

package info (click to toggle)
libclang-perl 0.09-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 276 kB
  • sloc: perl: 297; cpp: 55; makefile: 10; ansic: 8
file content (23 lines) | stat: -rw-r--r-- 566 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
#!perl -T

use Test::More;

use Clang;

my $index = Clang::Index -> new(0);
my $tunit = $index -> parse('t/fragments/test.c');
my $cursr = $tunit -> cursor;

my $diags = $tunit -> diagnostics;

my @formats  = map { $_ -> format(1) } @$diags;
my @expected = (
	"t/fragments/test.c:2:10: error: use of undeclared identifier 'argp'",
	"t/fragments/test.c:4:2: error: void function 'foo' should not return a value",
	"t/fragments/test.c:8:6: error: initializing 'int' with an expression of incompatible type 'void'"
);

is_deeply(\@formats, \@expected);

done_testing;