From 2423750a9509bf2d1e1f10b4ff578a80f64be12e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fa=C3=A7=20Eldenk?= Date: Wed, 9 Nov 2022 10:10:57 +0300 Subject: [PATCH] format --- .../src/commonMain/kotlin/pbandk/gen/FileBuilder.kt | 3 ++- .../lib/src/jvmTest/kotlin/CodeGeneratorTest.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt b/protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt index 798c010b..f6a06a9f 100644 --- a/protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt +++ b/protoc-gen-pbandk/lib/src/commonMain/kotlin/pbandk/gen/FileBuilder.kt @@ -263,8 +263,9 @@ internal open class FileBuilder(val namer: Namer = Namer.Standard, val supportMa } else { to } - } else + } else { null + } } } diff --git a/protoc-gen-pbandk/lib/src/jvmTest/kotlin/CodeGeneratorTest.kt b/protoc-gen-pbandk/lib/src/jvmTest/kotlin/CodeGeneratorTest.kt index f4cc3182..c4f01852 100644 --- a/protoc-gen-pbandk/lib/src/jvmTest/kotlin/CodeGeneratorTest.kt +++ b/protoc-gen-pbandk/lib/src/jvmTest/kotlin/CodeGeneratorTest.kt @@ -83,7 +83,7 @@ class CodeGeneratorTest { result.classLoader.loadClass("newname.pkg.Message1").kotlin result.classLoader.loadClass("newname.pkg.Message2").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("foobar.Message1").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("foobar.Message1").kotlin } } @@ -98,7 +98,7 @@ class CodeGeneratorTest { result.classLoader.loadClass("newname.pkg.foobar.Message1").kotlin result.classLoader.loadClass("newname.pkg.foobar.Message2").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("foobar.Message1").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("foobar.Message1").kotlin } } @Test @@ -112,7 +112,7 @@ class CodeGeneratorTest { result.classLoader.loadClass("newname.pkg.Message1").kotlin result.classLoader.loadClass("newname.pkg.Message2").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("foobar.Message1").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("foobar.Message1").kotlin } } @Test @@ -127,7 +127,7 @@ class CodeGeneratorTest { result.classLoader.loadClass("foobar.Message2").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("newname.pkg.Message1").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("newname.pkg.Message1").kotlin } } @Test @@ -140,7 +140,7 @@ class CodeGeneratorTest { // New package name should replace the prefix. result.classLoader.loadClass("newname.testpb.Proto3PresenceMessage").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("pbandk.testpb.Proto3PresenceMessage").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("pbandk.testpb.Proto3PresenceMessage").kotlin } } @Test @@ -154,7 +154,7 @@ class CodeGeneratorTest { result.classLoader.loadClass("newname.javapackage.Foo").kotlin result.classLoader.loadClass("newname.javapackage.Goo").kotlin - assertTrue(kotlin.runCatching { result.classLoader.loadClass("pbandk.javapackage.Foo").kotlin }.isFailure) + assertFails { result.classLoader.loadClass("pbandk.javapackage.Foo").kotlin } } private fun compileProto(inputProto: String, parameter: String? = null): KotlinCompilation.Result {