fix(tests): restore the order of signal parameters

master
Dominique Merle 4 years ago
parent f65800f8d8
commit db81f78e12

@ -18,8 +18,8 @@ static func make(__name):
func set_name(__name:String) -> void:
var invalid = RegEx.new()
invalid.compile("[^a-zA-Z0-9+._-]+")
__name = invalid.sub(__name, '', true)
# invalid.compile("[^a-zA-Z0-9+._-]+")
# __name = invalid.sub(__name, '', true)
__name = __name.substr(0, min(__name.length(), 20))
if "" == __name:
printerr("Participant name is empty!")

@ -231,7 +231,7 @@ func get_or_create_participant(identifier:String) -> MajorityJudgmentParticipant
var __save_mutex := Mutex.new() # perhaps overzealous
func __on_judgment_emitted(author_identifier, grade_index, candidate_index):
func __on_judgment_emitted(author_identifier, candidate_index, grade_index):
# Data comes from userland, best be extra careful in here
if (
grade_index < 0

@ -25,8 +25,8 @@ class_name MajorityJudgmentAbstractJudgmentsProvider
signal judgment_emitted(
author_identifier, # String, unique per author (aka participant)
grade_index, # int (0 == REJECT, up to the grading size minus one)
candidate_index # int, position in the original array of candidates
candidate_index, # int, position in the original array of candidates
grade_index # int (0 == REJECT, up to the grading size minus one)
)

@ -35,7 +35,7 @@ class_name MajorityJudgmentChatCommandJudgmentsProvider
func process_chat_command(author_identifier:String, chat_command:String):
var regex = RegEx.new()
regex.compile("(?<candidate>[a-zA-Z]{1,2})(?<grade>[0-9]{1,2})")
regex.compile("(?<candidate>[a-zA-Z]{1})(?<grade>[0-9]{1})")
var results = regex.search_all(chat_command)
if results:
@ -49,6 +49,6 @@ func process_chat_command(author_identifier:String, chat_command:String):
emit_signal(
"judgment_emitted",
author_identifier,
grade_index,
candidate_index
candidate_index,
grade_index
)

@ -86,7 +86,6 @@ func test_common_usage():
asserts.is_equal(poll_tally.candidates_tallies[0].position, 1, "Rantanplan is number one")
var saved_tally = ResourceSaver.save('res://test_poll_tally.tres', poll_tally)
asserts.is_equal(saved_tally, OK, "Save Poll Tally to file")
@ -105,4 +104,3 @@ func test_common_usage():
asserts.is_class_instance(loaded_poll.candidates[0], MajorityJudgmentCandidate, "Loaded poll has correct candidates")
asserts.is_equal(loaded_poll.candidates[1].name, 'Rantanplan', "Loaded poll has correct candidates names")

Loading…
Cancel
Save