-
Notifications
You must be signed in to change notification settings - Fork 564
Expand file tree
/
Copy pathBGenBase.cs
More file actions
53 lines (46 loc) · 1.83 KB
/
BGenBase.cs
File metadata and controls
53 lines (46 loc) · 1.83 KB
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
49
50
51
52
53
using System.Linq;
using System.IO;
using Xamarin.Tests;
namespace GeneratorTests {
public class BGenBase {
internal BGenTool BuildFile (Profile profile, params string [] filenames)
{
return BuildFile (profile, true, false, filenames);
}
internal BGenTool BuildFile (Profile profile, bool nowarnings, params string [] filenames)
{
return BuildFile (profile, nowarnings, false, filenames);
}
internal BGenTool BuildFile (Profile profile, bool nowarnings, bool processEnums, params string [] filenames)
{
return BuildFile (profile, nowarnings, processEnums, Enumerable.Empty<string> (), filenames);
}
internal BGenTool BuildFile (Profile profile, bool nowarnings, bool processEnums, IEnumerable<string> references, params string [] filenames)
{
return BuildFile (profile, nowarnings, (bgen) => {
bgen.ProcessEnums = processEnums;
bgen.References = references.ToList ();
}, filenames);
}
internal BGenTool BuildFile (Profile profile, Action<BGenTool> configure, params string [] filenames)
{
return BuildFile (profile, true, configure, filenames);
}
internal BGenTool BuildFile (Profile profile, bool nowarnings, Action<BGenTool> configure, params string [] filenames)
{
Configuration.IgnoreIfIgnoredPlatform (profile.AsPlatform ());
var bgen = new BGenTool ();
bgen.Profile = profile;
bgen.Defines = BGenTool.GetDefaultDefines (profile);
configure (bgen);
TestContext.Out.WriteLine (TestContext.CurrentContext.Test.FullName);
foreach (var filename in filenames)
TestContext.Out.WriteLine ($"\t{filename}");
bgen.CreateTemporaryBinding (filenames.Select ((filename) => File.ReadAllText (Path.Combine (Configuration.SourceRoot, "tests", "bgen", "tests", filename))).ToArray ());
bgen.AssertExecute ("build");
if (nowarnings)
bgen.AssertNoWarnings ();
return bgen;
}
}
}