From e527c06e33a1c681cac2049f4934f7b733a526b1 Mon Sep 17 00:00:00 2001 From: Pavlo Stavytskyi Date: Mon, 14 Jun 2021 09:09:02 +0300 Subject: [PATCH] fixed tests --- .../AndroidDataBindingTemplateTests.kt | 6 ------ .../format/AssignmentFormatterTests.kt | 20 ++++--------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/airin-starlark/src/functionalTest/kotlin/org/morfly/airin/starlark/android_data_binding/AndroidDataBindingTemplateTests.kt b/airin-starlark/src/functionalTest/kotlin/org/morfly/airin/starlark/android_data_binding/AndroidDataBindingTemplateTests.kt index 33b778b7..4fe45c57 100644 --- a/airin-starlark/src/functionalTest/kotlin/org/morfly/airin/starlark/android_data_binding/AndroidDataBindingTemplateTests.kt +++ b/airin-starlark/src/functionalTest/kotlin/org/morfly/airin/starlark/android_data_binding/AndroidDataBindingTemplateTests.kt @@ -48,9 +48,7 @@ class AndroidDataBindingTemplateTests : ShouldSpec({ package(default_visibility = ["//visibility:public"]) DATABINDING_LAYOUTS = ["src/main/res/layout/layout_lib1.xml"] - VIEW_MODELS_WITH_RES_IMPORTS = [] - VIEW_MODELS = ["src/main/kotlin/org/morfly/airin/test/lib1/Lib1ViewModel.kt"] + [ "modify_imports_in_" + view_model_with_res_imports[0:-3] for view_model_with_res_imports in VIEW_MODELS_WITH_RES_IMPORTS @@ -70,9 +68,7 @@ class AndroidDataBindingTemplateTests : ShouldSpec({ ] BINDING_ADAPTERS = ["src/main/kotlin/org/morfly/airin/test/lib1/BindingAdapters.java"] - EXCLUDED_LIB1_FILES = VIEW_MODELS + VIEW_MODELS_WITH_RES_IMPORTS + BINDING_ADAPTERS - LIB1_FILES_WITH_RESOURCE_IMPORTS = glob( [ "src/main/kotlin/**/*.kt", @@ -80,7 +76,6 @@ class AndroidDataBindingTemplateTests : ShouldSpec({ ], exclude = EXCLUDED_LIB1_FILES, ) - LIB1_FILES = [ "modify_imports_in_" + app_files_with_res_imports[0:-3] for app_files_with_res_imports in LIB1_FILES_WITH_RESOURCE_IMPORTS @@ -169,7 +164,6 @@ class AndroidDataBindingTemplateTests : ShouldSpec({ ["src/main/AndroidManifest.xml"], visibility = ["//:__pkg__"], ) - """.trimIndent() writer.write(null, file) shouldBe expectedResult diff --git a/airin-starlark/src/test/kotlin/org/morfly/airin/starlark/format/AssignmentFormatterTests.kt b/airin-starlark/src/test/kotlin/org/morfly/airin/starlark/format/AssignmentFormatterTests.kt index 96b37541..a92d25c7 100644 --- a/airin-starlark/src/test/kotlin/org/morfly/airin/starlark/format/AssignmentFormatterTests.kt +++ b/airin-starlark/src/test/kotlin/org/morfly/airin/starlark/format/AssignmentFormatterTests.kt @@ -48,7 +48,7 @@ class AssignmentFormatterTests : ShouldSpec({ val builder = StringBuilder() formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) - val expectedResult = "\n${___4}VARIABLE = None" + val expectedResult = "${___4}VARIABLE = None" builder.toString() shouldBe expectedResult } @@ -60,7 +60,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = "value" """.trimMargin() @@ -74,7 +73,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = 1 """.trimMargin() @@ -88,7 +86,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = 1.5 """.trimMargin() @@ -102,7 +99,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = True """.trimMargin() @@ -115,7 +111,7 @@ class AssignmentFormatterTests : ShouldSpec({ val builder = StringBuilder() formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) - val expectedResult = "\n${___4}VARIABLE = []" + val expectedResult = "${___4}VARIABLE = []" builder.toString() shouldBe expectedResult } @@ -130,7 +126,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = ["item"] """.trimMargin() @@ -147,7 +142,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = [ |${_______8}"item1", |${_______8}"item2", @@ -163,7 +157,7 @@ class AssignmentFormatterTests : ShouldSpec({ val builder = StringBuilder() formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) - val expectedResult = "\n${___4}VARIABLE = {}" + val expectedResult = "${___4}VARIABLE = {}" builder.toString() shouldBe expectedResult } @@ -178,7 +172,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = {"key": "value"} """.trimMargin() @@ -200,7 +193,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = { |${_______8}"key1": "value1", |${_______8}"key2": 2, @@ -216,7 +208,7 @@ class AssignmentFormatterTests : ShouldSpec({ val builder = StringBuilder() formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) - val expectedResult = "\n${___4}VARIABLE = ANOTHER_VARIABLE" + val expectedResult = "${___4}VARIABLE = ANOTHER_VARIABLE" builder.toString() shouldBe expectedResult } @@ -236,7 +228,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE_3 = VARIABLE_1 + VARIABLE_2 """.trimMargin() @@ -258,7 +249,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = "string1" + "string2" """.trimMargin() @@ -280,7 +270,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = [ |${_______8}"item1", |${_______8}"item2", @@ -313,7 +302,6 @@ class AssignmentFormatterTests : ShouldSpec({ formatter.visit(assignment, position = 1, mode = NEW_LINE, builder) val expectedResult = """ - | |${___4}VARIABLE = {"key1": "value1"} + { |${_______8}"key2": "value2", |${_______8}"key3": 3,