Test constants in imported non-generated structures and interfaces.

This commit is contained in:
Kuba Ober 2019-08-30 11:23:44 -04:00
parent e13a8751dc
commit e2cfb8aaf1
6 changed files with 44 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[] UnitTest11_capnp {
get {
object obj = ResourceManager.GetObject("UnitTest11_capnp", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>

View File

@ -136,4 +136,7 @@
<data name="schema_with_offsets_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\schema-with-offsets.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="UnitTest11_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\UnitTest11.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

View File

@ -0,0 +1,15 @@
@0xe4369c441ab8df19;
using Imported = import "UnitTest11b.capnp";
struct OuterStruct {
innerStruct @0: Imported.InnerStruct;
innerInterface @1: Imported.InnerInterface;
}
interface OuterInterface {
struct Wrapper {
innerStruct @0: Imported.InnerStruct;
innerInterface @1: Imported.InnerInterface;
}
}

View File

@ -0,0 +1,9 @@
@0xabc4e69d23fe287e;
struct InnerStruct {
const constantS: Bool = false;
}
interface InnerInterface {
const constantI: Bool = false;
}

View File

@ -71,6 +71,13 @@ namespace CapnpC
Assert.AreEqual($"{innerNSStr}.Inner", innerNameSyntax.ToString());
}
[TestMethod]
public void Test11ImportedConst()
{
var model = Load(Resources.UnitTest11_capnp);
// Should not throw
}
[TestMethod]
public void Test20AnnotationAndConst()
{