File: 03-cursorkind.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-- 424 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 $kind  = $cursr -> kind;

is($kind -> spelling, 'TranslationUnit');

my $cursors = $cursr -> children;

my @spellings = map { $_ -> kind -> spelling } @$cursors;
my @expected  = qw(
	FunctionDecl
	FunctionDecl
);
is_deeply(\@spellings, \@expected);

done_testing;