3
# Tests the logic for extracting the list of functions in a C# program
10
unless ( $ENV{DISPLAY} or $^O eq 'MSWin32' ) {
11
plan skip_all => 'Needs DISPLAY';
18
use Padre::Document::CSharp::FunctionList ();
20
# Sample code we will be parsing
21
my $code = <<'END_CS';
23
public static void Bogus(a, b)
27
//public static void Bogus(a, b) { }
29
public static void Main(string[] args)
34
protected override void Init()
37
public abstract void MyAbstractMethod();
39
public byte[] ToByteArray();
41
public static T StaticGenericMethod<T>(arguments);
43
public sealed List<int>[] GenericArrayReturnType();
45
public virtual string[,] TwoDimArrayReturnType();
47
public abstract List<int> GetList();
49
private int Subtract(int a, int b)
54
private int Add(int a, int b)
59
[Test()] public void TestMethod() { }
62
######################################################################
67
# Create the function list parser
69
'Padre::Document::CSharp::FunctionList',
73
# Executing the parsing job
74
ok( $task->run, '->run ok' );
76
# Check the result of the parsing
84
GenericArrayReturnType
92
'Found expected functions',
100
######################################################################
101
# Alphabetical Ordering
105
# Create the function list parser
107
'Padre::Document::CSharp::FunctionList',
109
order => 'alphabetical',
113
# Executing the parsing job
114
ok( $task->run, '->run ok' );
116
# Check the result of the parsing
121
GenericArrayReturnType
129
TwoDimArrayReturnType
132
'Found expected functions (alphabetical)',
140
######################################################################
141
# Alphabetical Ordering (Private Last)
145
# Create the function list parser
147
'Padre::Document::CSharp::FunctionList',
149
order => 'alphabetical_private_last',
153
# Executing the parsing job
154
ok( $task->run, '->run ok' );
156
# Check the result of the parsing
161
GenericArrayReturnType
169
TwoDimArrayReturnType
172
'Found expected functions (alphabetical_private_last)',