-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rd-gen: add tests for documentation in models
- Loading branch information
Showing
13 changed files
with
886 additions
and
3 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
...t/kotlin/com/jetbrains/rd/generator/test/cases/generator/cpp/CppDocumentationModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.jetbrains.rd.generator.test.cases.generator.cpp | ||
|
||
import com.jetbrains.rd.generator.test.cases.generator.testModels.DocumentationModelRoot | ||
import com.jetbrains.rd.generator.testframework.CppRdGenOutputTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class CppDocumentationModelTest : CppRdGenOutputTest() { | ||
|
||
companion object { | ||
const val TEST_NAME = "documentationModelTest" | ||
} | ||
|
||
override val testName = TEST_NAME | ||
|
||
override val verifyComments = true | ||
|
||
override fun expectedFileCount(model: Class<*>) = when (model) { | ||
DocumentationModelRoot::class.java -> 2 | ||
else -> 0 | ||
} | ||
|
||
@Test | ||
fun test1() = doTest<DocumentationModelRoot>(DocumentationModelRoot::class.java) | ||
} |
19 changes: 19 additions & 0 deletions
19
...in/com/jetbrains/rd/generator/test/cases/generator/csharp/CSharpDocumentationModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.jetbrains.rd.generator.test.cases.generator.csharp | ||
|
||
import com.jetbrains.rd.generator.test.cases.generator.testModels.DocumentationModelRoot | ||
import com.jetbrains.rd.generator.testframework.CSharpRdGenOutputTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class CSharpDocumentationModelTest : CSharpRdGenOutputTest() { | ||
|
||
companion object { | ||
const val TEST_NAME = "documentationModelTest" | ||
} | ||
|
||
override val testName = TEST_NAME | ||
|
||
override val verifyComments = true | ||
|
||
@Test | ||
fun test1() = doTest<DocumentationModelRoot>(DocumentationModelRoot::class.java) | ||
} |
19 changes: 19 additions & 0 deletions
19
...in/com/jetbrains/rd/generator/test/cases/generator/kotlin/KotlinDocumentationModelTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.jetbrains.rd.generator.test.cases.generator.kotlin | ||
|
||
import com.jetbrains.rd.generator.test.cases.generator.testModels.DocumentationModelRoot | ||
import com.jetbrains.rd.generator.testframework.KotlinRdGenOutputTest | ||
import org.junit.jupiter.api.Test | ||
|
||
class KotlinDocumentationModelTest : KotlinRdGenOutputTest() { | ||
|
||
companion object { | ||
const val TEST_NAME = "documentationModelTest" | ||
} | ||
|
||
override val testName = TEST_NAME | ||
|
||
override val verifyComments = true | ||
|
||
@Test | ||
fun test1() = doTest<DocumentationModelRoot>(DocumentationModelRoot::class.java) | ||
} |
19 changes: 19 additions & 0 deletions
19
...tlin/com/jetbrains/rd/generator/test/cases/generator/testModels/ModelWithDocumentation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.jetbrains.rd.generator.test.cases.generator.testModels | ||
|
||
import com.jetbrains.rd.generator.nova.* | ||
import com.jetbrains.rd.generator.test.cases.generator.cpp.CppDocumentationModelTest | ||
import com.jetbrains.rd.generator.test.cases.generator.csharp.CSharpDocumentationModelTest | ||
import com.jetbrains.rd.generator.test.cases.generator.kotlin.KotlinDocumentationModelTest | ||
import com.jetbrains.rd.generator.testframework.CSharpRdGenOutputTest | ||
import com.jetbrains.rd.generator.testframework.CppRdGenOutputTest | ||
import com.jetbrains.rd.generator.testframework.KotlinRdGenOutputTest | ||
|
||
object DocumentationModelRoot : Root( | ||
*KotlinRdGenOutputTest.generators(KotlinDocumentationModelTest.TEST_NAME, "org.example"), | ||
*CppRdGenOutputTest.generators(CppDocumentationModelTest.TEST_NAME, "org.example"), | ||
*CSharpRdGenOutputTest.generators(CSharpDocumentationModelTest.TEST_NAME, "org.example") | ||
) { | ||
init { | ||
documentation = "This is a documentation test,\nand it is also multiline." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
.../rd-gen/src/test/resources/testData/documentationModelTest/asis/DocumentationModelRoot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a RdGen v1.13. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
using System; | ||
using System.Linq; | ||
using System.Collections.Generic; | ||
using System.Runtime.InteropServices; | ||
using JetBrains.Annotations; | ||
|
||
using JetBrains.Core; | ||
using JetBrains.Diagnostics; | ||
using JetBrains.Collections; | ||
using JetBrains.Collections.Viewable; | ||
using JetBrains.Lifetimes; | ||
using JetBrains.Serialization; | ||
using JetBrains.Rd; | ||
using JetBrains.Rd.Base; | ||
using JetBrains.Rd.Impl; | ||
using JetBrains.Rd.Tasks; | ||
using JetBrains.Rd.Util; | ||
using JetBrains.Rd.Text; | ||
|
||
|
||
// ReSharper disable RedundantEmptyObjectCreationArgumentList | ||
// ReSharper disable InconsistentNaming | ||
// ReSharper disable RedundantOverflowCheckingContext | ||
|
||
|
||
namespace org.example | ||
{ | ||
|
||
|
||
/// <summary> | ||
/// This is a documentation test, | ||
and it is also multiline. | ||
/// <p>Generated from: ModelWithDocumentation.kt:14</p> | ||
/// </summary> | ||
public class DocumentationModelRoot : RdExtBase | ||
{ | ||
//fields | ||
//public fields | ||
|
||
//private fields | ||
//primary constructor | ||
private DocumentationModelRoot( | ||
) | ||
{ | ||
} | ||
//secondary constructor | ||
//deconstruct trait | ||
//statics | ||
|
||
|
||
|
||
protected override long SerializationHash => -7782552752810534509L; | ||
|
||
protected override Action<ISerializers> Register => RegisterDeclaredTypesSerializers; | ||
public static void RegisterDeclaredTypesSerializers(ISerializers serializers) | ||
{ | ||
|
||
serializers.RegisterToplevelOnce(typeof(DocumentationModelRoot), DocumentationModelRoot.RegisterDeclaredTypesSerializers); | ||
} | ||
|
||
public DocumentationModelRoot(Lifetime lifetime, IProtocol protocol) : this() | ||
{ | ||
Identify(protocol.Identities, RdId.Root.Mix("DocumentationModelRoot")); | ||
this.BindTopLevel(lifetime, protocol, "DocumentationModelRoot"); | ||
} | ||
|
||
//constants | ||
|
||
//custom body | ||
//methods | ||
//equals trait | ||
//hash code trait | ||
//pretty print | ||
public override void Print(PrettyPrinter printer) | ||
{ | ||
printer.Println("DocumentationModelRoot ("); | ||
printer.Print(")"); | ||
} | ||
//toString | ||
public override string ToString() | ||
{ | ||
var printer = new SingleLinePrettyPrinter(); | ||
Print(printer); | ||
return printer.ToString(); | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
.../rd-gen/src/test/resources/testData/documentationModelTest/asis/DocumentationModelRoot.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@file:Suppress("EXPERIMENTAL_API_USAGE","EXPERIMENTAL_UNSIGNED_LITERALS","PackageDirectoryMismatch","UnusedImport","unused","LocalVariableName","CanBeVal","PropertyName","EnumEntryName","ClassName","ObjectPropertyName","UnnecessaryVariable","SpellCheckingInspection") | ||
package org.example | ||
|
||
import com.jetbrains.rd.framework.* | ||
import com.jetbrains.rd.framework.base.* | ||
import com.jetbrains.rd.framework.impl.* | ||
|
||
import com.jetbrains.rd.util.lifetime.* | ||
import com.jetbrains.rd.util.reactive.* | ||
import com.jetbrains.rd.util.string.* | ||
import com.jetbrains.rd.util.* | ||
import kotlin.time.Duration | ||
import kotlin.reflect.KClass | ||
import kotlin.jvm.JvmStatic | ||
|
||
|
||
|
||
/** | ||
* This is a documentation test, | ||
and it is also multiline. | ||
* #### Generated from [ModelWithDocumentation.kt:14] | ||
*/ | ||
class DocumentationModelRoot private constructor( | ||
) : RdExtBase() { | ||
//companion | ||
|
||
companion object : ISerializersOwner { | ||
|
||
override fun registerSerializersCore(serializers: ISerializers) { | ||
DocumentationModelRoot.register(serializers) | ||
} | ||
|
||
|
||
|
||
|
||
|
||
const val serializationHash = -7782552752810534509L | ||
|
||
} | ||
override val serializersOwner: ISerializersOwner get() = DocumentationModelRoot | ||
override val serializationHash: Long get() = DocumentationModelRoot.serializationHash | ||
|
||
//fields | ||
//methods | ||
//initializer | ||
//secondary constructor | ||
//equals trait | ||
//hash code trait | ||
//pretty print | ||
override fun print(printer: PrettyPrinter) { | ||
printer.println("DocumentationModelRoot (") | ||
printer.print(")") | ||
} | ||
//deepClone | ||
override fun deepClone(): DocumentationModelRoot { | ||
return DocumentationModelRoot( | ||
) | ||
} | ||
//contexts | ||
//threading | ||
override val extThreading: ExtThreadingKind get() = ExtThreadingKind.Default | ||
} |
95 changes: 95 additions & 0 deletions
95
...es/testData/documentationModelTest/asis/DocumentationModelRoot/DocumentationModelRoot.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a RdGen v1.13. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
#include "DocumentationModelRoot.Generated.h" | ||
|
||
|
||
#include "DocumentationModelRoot/DocumentationModelRoot.Generated.h" | ||
#include "DocumentationModelRoot/DocumentationModelRoot.Generated.h" | ||
|
||
#ifdef _MSC_VER | ||
#pragma warning( push ) | ||
#pragma warning( disable:4250 ) | ||
#pragma warning( disable:4307 ) | ||
#pragma warning( disable:4267 ) | ||
#pragma warning( disable:4244 ) | ||
#pragma warning( disable:4100 ) | ||
#endif | ||
|
||
namespace org.example { | ||
// companion | ||
|
||
DocumentationModelRoot::DocumentationModelRootSerializersOwner const DocumentationModelRoot::serializersOwner; | ||
|
||
void DocumentationModelRoot::DocumentationModelRootSerializersOwner::registerSerializersCore(rd::Serializers const& serializers) const | ||
{ | ||
} | ||
|
||
void DocumentationModelRoot::connect(rd::Lifetime lifetime, rd::IProtocol const * protocol) | ||
{ | ||
DocumentationModelRoot::serializersOwner.registry(protocol->get_serializers()); | ||
|
||
identify(*(protocol->get_identity()), rd::RdId::Null().mix("DocumentationModelRoot")); | ||
bind(lifetime, protocol, "DocumentationModelRoot"); | ||
} | ||
|
||
// constants | ||
// initializer | ||
void DocumentationModelRoot::initialize() | ||
{ | ||
serializationHash = -7782552752810534509L; | ||
} | ||
// primary ctor | ||
// secondary constructor | ||
// default ctors and dtors | ||
DocumentationModelRoot::DocumentationModelRoot() | ||
{ | ||
initialize(); | ||
} | ||
// reader | ||
// writer | ||
// virtual init | ||
void DocumentationModelRoot::init(rd::Lifetime lifetime) const | ||
{ | ||
rd::RdExtBase::init(lifetime); | ||
} | ||
// identify | ||
void DocumentationModelRoot::identify(const rd::Identities &identities, rd::RdId const &id) const | ||
{ | ||
rd::RdBindableBase::identify(identities, id); | ||
} | ||
// getters | ||
// intern | ||
// equals trait | ||
// equality operators | ||
bool operator==(const DocumentationModelRoot &lhs, const DocumentationModelRoot &rhs) { | ||
return &lhs == &rhs; | ||
} | ||
bool operator!=(const DocumentationModelRoot &lhs, const DocumentationModelRoot &rhs){ | ||
return !(lhs == rhs); | ||
} | ||
// hash code trait | ||
// type name trait | ||
// static type name trait | ||
// polymorphic to string | ||
std::string DocumentationModelRoot::toString() const | ||
{ | ||
std::string res = "DocumentationModelRoot\n"; | ||
return res; | ||
} | ||
// external to string | ||
std::string to_string(const DocumentationModelRoot & value) | ||
{ | ||
return value.toString(); | ||
} | ||
} | ||
|
||
#ifdef _MSC_VER | ||
#pragma warning( pop ) | ||
#endif | ||
|
Oops, something went wrong.