From 4bfcaced21a43d711b929279a8eeb16390c058e3 Mon Sep 17 00:00:00 2001 From: Isaac Good Date: Mon, 2 Nov 2026 13:28:02 -0800 Subject: [PATCH] Refresh test runner This pulls in https://github.com/exercism/gdscript-test-runner/pull/87 > Support an optional output message on failed tests --- exercises/practice/acronym/lib/test_runner.gd | 18 +++++++++--------- .../practice/all-your-base/lib/test_runner.gd | 18 +++++++++--------- .../practice/allergies/lib/test_runner.gd | 18 +++++++++--------- .../practice/alphametics/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/anagram/lib/test_runner.gd | 18 +++++++++--------- .../armstrong-numbers/lib/test_runner.gd | 18 +++++++++--------- .../practice/atbash-cipher/lib/test_runner.gd | 18 +++++++++--------- .../baffling-birthdays/lib/test_runner.gd | 18 +++++++++--------- .../binary-search-tree/lib/test_runner.gd | 18 +++++++++--------- .../practice/binary-search/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/bob/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/camicia/lib/test_runner.gd | 18 +++++++++--------- .../circular-buffer/lib/test_runner.gd | 18 +++++++++--------- .../collatz-conjecture/lib/test_runner.gd | 18 +++++++++--------- .../practice/custom-set/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/darts/lib/test_runner.gd | 18 +++++++++--------- .../difference-of-squares/lib/test_runner.gd | 18 +++++++++--------- .../practice/eliuds-eggs/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/etl/lib/test_runner.gd | 18 +++++++++--------- .../practice/flatten-array/lib/test_runner.gd | 18 +++++++++--------- .../practice/flower-field/lib/test_runner.gd | 18 +++++++++--------- .../practice/food-chain/lib/test_runner.gd | 18 +++++++++--------- .../practice/game-of-life/lib/test_runner.gd | 18 +++++++++--------- .../practice/gigasecond/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/grains/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/hamming/lib/test_runner.gd | 18 +++++++++--------- .../practice/hello-world/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/isogram/lib/test_runner.gd | 18 +++++++++--------- .../killer-sudoku-helper/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/leap/lib/test_runner.gd | 18 +++++++++--------- .../practice/linked-list/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/luhn/lib/test_runner.gd | 18 +++++++++--------- .../matching-brackets/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/matrix/lib/test_runner.gd | 18 +++++++++--------- .../practice/nth-prime/lib/test_runner.gd | 18 +++++++++--------- .../nucleotide-count/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/pangram/lib/test_runner.gd | 18 +++++++++--------- .../perfect-numbers/lib/test_runner.gd | 18 +++++++++--------- .../practice/phone-number/lib/test_runner.gd | 18 +++++++++--------- .../practice/prime-factors/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/prism/lib/test_runner.gd | 18 +++++++++--------- .../protein-translation/lib/test_runner.gd | 18 +++++++++--------- .../pythagorean-triplet/lib/test_runner.gd | 18 +++++++++--------- .../practice/raindrops/lib/test_runner.gd | 18 +++++++++--------- .../rational-numbers/lib/test_runner.gd | 18 +++++++++--------- .../resistor-color-duo/lib/test_runner.gd | 18 +++++++++--------- .../lib/test_runner.gd | 18 +++++++++--------- .../resistor-color-trio/lib/test_runner.gd | 18 +++++++++--------- .../practice/resistor-color/lib/test_runner.gd | 18 +++++++++--------- .../practice/reverse-string/lib/test_runner.gd | 18 +++++++++--------- .../practice/robot-name/lib/test_runner.gd | 18 +++++++++--------- .../robot-simulator/lib/test_runner.gd | 18 +++++++++--------- .../run-length-encoding/lib/test_runner.gd | 18 +++++++++--------- .../practice/saddle-points/lib/test_runner.gd | 18 +++++++++--------- .../practice/save-the-cow/lib/test_runner.gd | 18 +++++++++--------- .../practice/scrabble-score/lib/test_runner.gd | 18 +++++++++--------- .../secret-handshake/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/series/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/sieve/lib/test_runner.gd | 18 +++++++++--------- .../practice/simple-cipher/lib/test_runner.gd | 18 +++++++++--------- .../simple-linked-list/lib/test_runner.gd | 18 +++++++++--------- .../practice/space-age/lib/test_runner.gd | 18 +++++++++--------- .../practice/spiral-matrix/lib/test_runner.gd | 18 +++++++++--------- .../practice/square-root/lib/test_runner.gd | 18 +++++++++--------- .../state-of-tic-tac-toe/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/sublist/lib/test_runner.gd | 18 +++++++++--------- .../sum-of-multiples/lib/test_runner.gd | 18 +++++++++--------- .../swift-scheduling/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/triangle/lib/test_runner.gd | 18 +++++++++--------- .../practice/two-bucket/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/two-fer/lib/test_runner.gd | 18 +++++++++--------- .../lib/test_runner.gd | 18 +++++++++--------- .../practice/word-count/lib/test_runner.gd | 18 +++++++++--------- exercises/practice/yacht/lib/test_runner.gd | 18 +++++++++--------- 74 files changed, 666 insertions(+), 666 deletions(-) diff --git a/exercises/practice/acronym/lib/test_runner.gd b/exercises/practice/acronym/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/acronym/lib/test_runner.gd +++ b/exercises/practice/acronym/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/all-your-base/lib/test_runner.gd b/exercises/practice/all-your-base/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/all-your-base/lib/test_runner.gd +++ b/exercises/practice/all-your-base/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/allergies/lib/test_runner.gd b/exercises/practice/allergies/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/allergies/lib/test_runner.gd +++ b/exercises/practice/allergies/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/alphametics/lib/test_runner.gd b/exercises/practice/alphametics/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/alphametics/lib/test_runner.gd +++ b/exercises/practice/alphametics/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/anagram/lib/test_runner.gd b/exercises/practice/anagram/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/anagram/lib/test_runner.gd +++ b/exercises/practice/anagram/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/armstrong-numbers/lib/test_runner.gd b/exercises/practice/armstrong-numbers/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/armstrong-numbers/lib/test_runner.gd +++ b/exercises/practice/armstrong-numbers/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/atbash-cipher/lib/test_runner.gd b/exercises/practice/atbash-cipher/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/atbash-cipher/lib/test_runner.gd +++ b/exercises/practice/atbash-cipher/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/baffling-birthdays/lib/test_runner.gd b/exercises/practice/baffling-birthdays/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/baffling-birthdays/lib/test_runner.gd +++ b/exercises/practice/baffling-birthdays/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/binary-search-tree/lib/test_runner.gd b/exercises/practice/binary-search-tree/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/binary-search-tree/lib/test_runner.gd +++ b/exercises/practice/binary-search-tree/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/binary-search/lib/test_runner.gd b/exercises/practice/binary-search/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/binary-search/lib/test_runner.gd +++ b/exercises/practice/binary-search/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/bob/lib/test_runner.gd b/exercises/practice/bob/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/bob/lib/test_runner.gd +++ b/exercises/practice/bob/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/camicia/lib/test_runner.gd b/exercises/practice/camicia/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/camicia/lib/test_runner.gd +++ b/exercises/practice/camicia/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/circular-buffer/lib/test_runner.gd b/exercises/practice/circular-buffer/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/circular-buffer/lib/test_runner.gd +++ b/exercises/practice/circular-buffer/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/collatz-conjecture/lib/test_runner.gd b/exercises/practice/collatz-conjecture/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/collatz-conjecture/lib/test_runner.gd +++ b/exercises/practice/collatz-conjecture/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/custom-set/lib/test_runner.gd b/exercises/practice/custom-set/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/custom-set/lib/test_runner.gd +++ b/exercises/practice/custom-set/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/darts/lib/test_runner.gd b/exercises/practice/darts/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/darts/lib/test_runner.gd +++ b/exercises/practice/darts/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/difference-of-squares/lib/test_runner.gd b/exercises/practice/difference-of-squares/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/difference-of-squares/lib/test_runner.gd +++ b/exercises/practice/difference-of-squares/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/eliuds-eggs/lib/test_runner.gd b/exercises/practice/eliuds-eggs/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/eliuds-eggs/lib/test_runner.gd +++ b/exercises/practice/eliuds-eggs/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/etl/lib/test_runner.gd b/exercises/practice/etl/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/etl/lib/test_runner.gd +++ b/exercises/practice/etl/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/flatten-array/lib/test_runner.gd b/exercises/practice/flatten-array/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/flatten-array/lib/test_runner.gd +++ b/exercises/practice/flatten-array/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/flower-field/lib/test_runner.gd b/exercises/practice/flower-field/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/flower-field/lib/test_runner.gd +++ b/exercises/practice/flower-field/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/food-chain/lib/test_runner.gd b/exercises/practice/food-chain/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/food-chain/lib/test_runner.gd +++ b/exercises/practice/food-chain/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/game-of-life/lib/test_runner.gd b/exercises/practice/game-of-life/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/game-of-life/lib/test_runner.gd +++ b/exercises/practice/game-of-life/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/gigasecond/lib/test_runner.gd b/exercises/practice/gigasecond/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/gigasecond/lib/test_runner.gd +++ b/exercises/practice/gigasecond/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/grains/lib/test_runner.gd b/exercises/practice/grains/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/grains/lib/test_runner.gd +++ b/exercises/practice/grains/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/hamming/lib/test_runner.gd b/exercises/practice/hamming/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/hamming/lib/test_runner.gd +++ b/exercises/practice/hamming/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/hello-world/lib/test_runner.gd b/exercises/practice/hello-world/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/hello-world/lib/test_runner.gd +++ b/exercises/practice/hello-world/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/isogram/lib/test_runner.gd b/exercises/practice/isogram/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/isogram/lib/test_runner.gd +++ b/exercises/practice/isogram/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/killer-sudoku-helper/lib/test_runner.gd b/exercises/practice/killer-sudoku-helper/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/killer-sudoku-helper/lib/test_runner.gd +++ b/exercises/practice/killer-sudoku-helper/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/leap/lib/test_runner.gd b/exercises/practice/leap/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/leap/lib/test_runner.gd +++ b/exercises/practice/leap/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/linked-list/lib/test_runner.gd b/exercises/practice/linked-list/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/linked-list/lib/test_runner.gd +++ b/exercises/practice/linked-list/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/luhn/lib/test_runner.gd b/exercises/practice/luhn/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/luhn/lib/test_runner.gd +++ b/exercises/practice/luhn/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/matching-brackets/lib/test_runner.gd b/exercises/practice/matching-brackets/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/matching-brackets/lib/test_runner.gd +++ b/exercises/practice/matching-brackets/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/matrix/lib/test_runner.gd b/exercises/practice/matrix/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/matrix/lib/test_runner.gd +++ b/exercises/practice/matrix/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/nth-prime/lib/test_runner.gd b/exercises/practice/nth-prime/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/nth-prime/lib/test_runner.gd +++ b/exercises/practice/nth-prime/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/nucleotide-count/lib/test_runner.gd b/exercises/practice/nucleotide-count/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/nucleotide-count/lib/test_runner.gd +++ b/exercises/practice/nucleotide-count/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/pangram/lib/test_runner.gd b/exercises/practice/pangram/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/pangram/lib/test_runner.gd +++ b/exercises/practice/pangram/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/perfect-numbers/lib/test_runner.gd b/exercises/practice/perfect-numbers/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/perfect-numbers/lib/test_runner.gd +++ b/exercises/practice/perfect-numbers/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/phone-number/lib/test_runner.gd b/exercises/practice/phone-number/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/phone-number/lib/test_runner.gd +++ b/exercises/practice/phone-number/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/prime-factors/lib/test_runner.gd b/exercises/practice/prime-factors/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/prime-factors/lib/test_runner.gd +++ b/exercises/practice/prime-factors/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/prism/lib/test_runner.gd b/exercises/practice/prism/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/prism/lib/test_runner.gd +++ b/exercises/practice/prism/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/protein-translation/lib/test_runner.gd b/exercises/practice/protein-translation/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/protein-translation/lib/test_runner.gd +++ b/exercises/practice/protein-translation/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/pythagorean-triplet/lib/test_runner.gd b/exercises/practice/pythagorean-triplet/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/pythagorean-triplet/lib/test_runner.gd +++ b/exercises/practice/pythagorean-triplet/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/raindrops/lib/test_runner.gd b/exercises/practice/raindrops/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/raindrops/lib/test_runner.gd +++ b/exercises/practice/raindrops/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/rational-numbers/lib/test_runner.gd b/exercises/practice/rational-numbers/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/rational-numbers/lib/test_runner.gd +++ b/exercises/practice/rational-numbers/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/resistor-color-duo/lib/test_runner.gd b/exercises/practice/resistor-color-duo/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/resistor-color-duo/lib/test_runner.gd +++ b/exercises/practice/resistor-color-duo/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/resistor-color-tolerance/lib/test_runner.gd b/exercises/practice/resistor-color-tolerance/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/resistor-color-tolerance/lib/test_runner.gd +++ b/exercises/practice/resistor-color-tolerance/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/resistor-color-trio/lib/test_runner.gd b/exercises/practice/resistor-color-trio/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/resistor-color-trio/lib/test_runner.gd +++ b/exercises/practice/resistor-color-trio/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/resistor-color/lib/test_runner.gd b/exercises/practice/resistor-color/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/resistor-color/lib/test_runner.gd +++ b/exercises/practice/resistor-color/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/reverse-string/lib/test_runner.gd b/exercises/practice/reverse-string/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/reverse-string/lib/test_runner.gd +++ b/exercises/practice/reverse-string/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/robot-name/lib/test_runner.gd b/exercises/practice/robot-name/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/robot-name/lib/test_runner.gd +++ b/exercises/practice/robot-name/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/robot-simulator/lib/test_runner.gd b/exercises/practice/robot-simulator/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/robot-simulator/lib/test_runner.gd +++ b/exercises/practice/robot-simulator/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/run-length-encoding/lib/test_runner.gd b/exercises/practice/run-length-encoding/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/run-length-encoding/lib/test_runner.gd +++ b/exercises/practice/run-length-encoding/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/saddle-points/lib/test_runner.gd b/exercises/practice/saddle-points/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/saddle-points/lib/test_runner.gd +++ b/exercises/practice/saddle-points/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/save-the-cow/lib/test_runner.gd b/exercises/practice/save-the-cow/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/save-the-cow/lib/test_runner.gd +++ b/exercises/practice/save-the-cow/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/scrabble-score/lib/test_runner.gd b/exercises/practice/scrabble-score/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/scrabble-score/lib/test_runner.gd +++ b/exercises/practice/scrabble-score/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/secret-handshake/lib/test_runner.gd b/exercises/practice/secret-handshake/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/secret-handshake/lib/test_runner.gd +++ b/exercises/practice/secret-handshake/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/series/lib/test_runner.gd b/exercises/practice/series/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/series/lib/test_runner.gd +++ b/exercises/practice/series/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/sieve/lib/test_runner.gd b/exercises/practice/sieve/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/sieve/lib/test_runner.gd +++ b/exercises/practice/sieve/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/simple-cipher/lib/test_runner.gd b/exercises/practice/simple-cipher/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/simple-cipher/lib/test_runner.gd +++ b/exercises/practice/simple-cipher/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/simple-linked-list/lib/test_runner.gd b/exercises/practice/simple-linked-list/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/simple-linked-list/lib/test_runner.gd +++ b/exercises/practice/simple-linked-list/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/space-age/lib/test_runner.gd b/exercises/practice/space-age/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/space-age/lib/test_runner.gd +++ b/exercises/practice/space-age/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/spiral-matrix/lib/test_runner.gd b/exercises/practice/spiral-matrix/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/spiral-matrix/lib/test_runner.gd +++ b/exercises/practice/spiral-matrix/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/square-root/lib/test_runner.gd b/exercises/practice/square-root/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/square-root/lib/test_runner.gd +++ b/exercises/practice/square-root/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/state-of-tic-tac-toe/lib/test_runner.gd b/exercises/practice/state-of-tic-tac-toe/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/state-of-tic-tac-toe/lib/test_runner.gd +++ b/exercises/practice/state-of-tic-tac-toe/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/sublist/lib/test_runner.gd b/exercises/practice/sublist/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/sublist/lib/test_runner.gd +++ b/exercises/practice/sublist/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/sum-of-multiples/lib/test_runner.gd b/exercises/practice/sum-of-multiples/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/sum-of-multiples/lib/test_runner.gd +++ b/exercises/practice/sum-of-multiples/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/swift-scheduling/lib/test_runner.gd b/exercises/practice/swift-scheduling/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/swift-scheduling/lib/test_runner.gd +++ b/exercises/practice/swift-scheduling/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/triangle/lib/test_runner.gd b/exercises/practice/triangle/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/triangle/lib/test_runner.gd +++ b/exercises/practice/triangle/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/two-bucket/lib/test_runner.gd b/exercises/practice/two-bucket/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/two-bucket/lib/test_runner.gd +++ b/exercises/practice/two-bucket/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/two-fer/lib/test_runner.gd b/exercises/practice/two-fer/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/two-fer/lib/test_runner.gd +++ b/exercises/practice/two-fer/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/variable-length-quantity/lib/test_runner.gd b/exercises/practice/variable-length-quantity/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/variable-length-quantity/lib/test_runner.gd +++ b/exercises/practice/variable-length-quantity/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/word-count/lib/test_runner.gd b/exercises/practice/word-count/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/word-count/lib/test_runner.gd +++ b/exercises/practice/word-count/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]] diff --git a/exercises/practice/yacht/lib/test_runner.gd b/exercises/practice/yacht/lib/test_runner.gd index be91311..6c750b2 100644 --- a/exercises/practice/yacht/lib/test_runner.gd +++ b/exercises/practice/yacht/lib/test_runner.gd @@ -291,18 +291,18 @@ class Runner: return methods - func get_failed_test_message(actual, expected) -> String: + func get_failed_test_message(output) -> String: """ - Generates a message for a failed test. If given values are strings, - this method will wrap them in single quotes, to distinguish from - other types, like integers (e.g. '3' vs 3). + Return the message to display for a failed test. - This method should be used if the actual and expected values for a - given test are different, or if they have different types. + `output` is a list containing `[actual, expected]` and an optional `message`. + If a message is provided, use it. Otherwise, format the actual and expected. """ - var values = [] + if len(output) == 3: + return output[2] - for value in [actual, expected]: + var values = [] + for value in output: var formatted_value = str(value) if typeof(value) == TYPE_STRING: formatted_value = "'{0}'".format([formatted_value]) @@ -370,7 +370,7 @@ class Runner: if error_message.is_empty(): status = "pass" if passed else "fail" error_message = ( - null if passed else self.get_failed_test_message(actual, expected) + null if passed else self.get_failed_test_message(output) ) var test_code = test_codes[method["name"]]