Skip to content

Commit ca40896

Browse files
committed
Add details in README files
1 parent 4892d88 commit ca40896

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

  • com.unity.netcode.gameobjects/Tests

com.unity.netcode.gameobjects/Tests/Editor/DocumentationCodeSamples/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,29 @@
33
Use this folder for any code snippets that only need to compile.
44

55
Any code snippets that you want to run tests on should be put in [Runtime tests](../../Runtime/Documentation/README.md).
6+
7+
To embed code in documentation, use the following tag
8+
9+
```md
10+
[!code-cs[](../../Tests/Editor/DocumentationCodeSamples/<Path/To/Test>.cs#SomeRegionName)]
11+
```
12+
13+
With the code formatted like this
14+
15+
```cs
16+
namespace DocumentationCodeSamples
17+
{
18+
internal MyTestClass
19+
{
20+
#region SomeRegionName
21+
// All the code in this region block will be embedded without indentation in the docs.
22+
#endregion
23+
24+
[Test]
25+
public void TestOfDocumentationCode()
26+
{
27+
...
28+
}
29+
}
30+
}
31+
```

com.unity.netcode.gameobjects/Tests/Runtime/DocumentationCodeSamples/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,31 @@
33
Use this folder for any code examples that we want to test to ensure the runtime functionality isn't broken
44

55
Any code snippets that are small enough that you only want to check that they compile should be in [Editor tests](../../Editor/Documentation/README.md).
6+
7+
To embed code in documentation, use the following tag
8+
9+
```md
10+
[!code-cs[](../../Tests/Runtime/DocumentationCodeSamples/<Path/To/Test>.cs#SomeRegionName)]
11+
```
12+
13+
With the code formatted like this
14+
15+
```cs
16+
namespace DocumentationCodeSamples
17+
{
18+
internal MyTestClass : NetcodeIntegrationTest
19+
{
20+
#region SomeRegionName
21+
// All the code in this region block will be embedded without indentation in the docs.
22+
#endregion
23+
24+
protected override int NumberOfClients => 1;
25+
26+
[UnityTest]
27+
public IEnumerator TestOfDocumentationCode()
28+
{
29+
...
30+
}
31+
}
32+
}
33+
```

0 commit comments

Comments
 (0)