Test annotations and constants in schemas processed for generation.

This commit is contained in:
Kuba Ober 2019-08-29 11:57:37 -04:00
parent 881a59b2c9
commit 84385bbecd
5 changed files with 27 additions and 0 deletions

View File

@ -90,6 +90,16 @@ namespace capnpc_csharp.Tests.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
internal static byte[] UnitTest20_capnp {
get {
object obj = ResourceManager.GetObject("UnitTest20_capnp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View File

@ -121,6 +121,9 @@
<data name="UnitTest10_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnitTest10.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="UnitTest20_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnitTest20.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="UnitTest3_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnitTest3.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>

Binary file not shown.

View File

@ -0,0 +1,5 @@
@0xcebb7a61a86a7492;
annotation anAnnotation(file): Text;
const aConstant :UInt16 = 42;

View File

@ -71,6 +71,15 @@ namespace CapnpC
Assert.AreEqual($"{innerNSStr}.Inner", innerNameSyntax.ToString());
}
[TestMethod]
public void Test20AnnotationAndConst()
{
var model = Load(Resources.UnitTest20_capnp);
var codeGen = NewGeneratorFor(model);
codeGen.Transform(model.FilesToGenerate.First());
// Should not throw
}
static Generator.CodeGenerator NewGeneratorFor(Model.SchemaModel model)
=> new Generator.CodeGenerator(model, new Generator.GeneratorOptions());