mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-03-12 14:51:41 +01:00
Test mutually recursive dependencies between nodes.
This commit is contained in:
parent
2460467fa4
commit
8b210d8b66
10
capnpc-csharp.tests/Properties/Resources.Designer.cs
generated
10
capnpc-csharp.tests/Properties/Resources.Designer.cs
generated
@ -129,5 +129,15 @@ namespace capnpc_csharp.Tests.Properties {
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
internal static byte[] UnitTest4_capnp {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("UnitTest4_capnp", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,4 +139,7 @@
|
||||
<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>
|
||||
<data name="UnitTest4_capnp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\UnitTest4.capnp.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
</root>
|
BIN
capnpc-csharp.tests/Resources/UnitTest4.capnp.bin
Normal file
BIN
capnpc-csharp.tests/Resources/UnitTest4.capnp.bin
Normal file
Binary file not shown.
16
capnpc-csharp.tests/UnitTest4.capnp
Normal file
16
capnpc-csharp.tests/UnitTest4.capnp
Normal file
@ -0,0 +1,16 @@
|
||||
@0xf463d204f5208b43;
|
||||
$import "/capnp/c++.capnp".namespace("UnitTest4");
|
||||
|
||||
interface Node {
|
||||
getInfo @0 () -> Info;
|
||||
}
|
||||
|
||||
struct Info {
|
||||
node @0 :Node;
|
||||
classes @1 :Classes;
|
||||
}
|
||||
|
||||
struct Classes {
|
||||
i1 @0 :import "UnitTest4b.capnp".I1.Classes;
|
||||
i2 @1: Void;
|
||||
}
|
15
capnpc-csharp.tests/UnitTest4b.capnp
Normal file
15
capnpc-csharp.tests/UnitTest4b.capnp
Normal file
@ -0,0 +1,15 @@
|
||||
@0x8151238e9f9884c8;
|
||||
$import "/capnp/c++.capnp".namespace("UnitTest4");
|
||||
|
||||
using Base = import "UnitTest4.capnp";
|
||||
|
||||
interface I1 {
|
||||
interface Node extends (Base.Node) {}
|
||||
struct Classes {
|
||||
sub @0: Sub;
|
||||
}
|
||||
struct Sub {
|
||||
const prototype :Base.Classes = ( i1 = (sub = ()) );
|
||||
data @0: Bool;
|
||||
}
|
||||
}
|
@ -45,6 +45,13 @@ namespace CapnpC
|
||||
// Should not throw
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test04MutualDependencies()
|
||||
{
|
||||
LoadAndGenerate(Resources.UnitTest4_capnp, 4);
|
||||
// Should not throw
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test10ImportedNamespaces()
|
||||
{
|
||||
|
@ -688,7 +688,7 @@ namespace CapnpC.Model
|
||||
{
|
||||
var def = ProcessNode(id, state, true, tag);
|
||||
var typeDef = def as TypeDefinition;
|
||||
if (def == null)
|
||||
if (typeDef == null)
|
||||
throw new ArgumentException(
|
||||
$"Expected node {id.StrId()} to be a TypeDefinition but got {def.GetType().Name} instead.",
|
||||
nameof(id));
|
||||
@ -748,10 +748,10 @@ namespace CapnpC.Model
|
||||
=> node.DisplayName.Substring((int)node.DisplayNamePrefixLength);
|
||||
|
||||
public static string StrId(this Schema.Node.Reader node)
|
||||
=> $"0x{node.Id.ToString("X")}";
|
||||
=> $"0x{node.Id:X}";
|
||||
|
||||
public static string StrId(this ulong nodeId)
|
||||
=> $"0x{nodeId.ToString("X")}";
|
||||
=> $"0x{nodeId:X}";
|
||||
|
||||
public static NodeKind GetKind(this Schema.Node.Reader node)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user