@@ -20,26 +20,31 @@ proc handlerMock(channel: ptr Channel[pointer]) =
2020
2121# handles data for a given service
2222proc handlerService_1 (channel: ptr Channel [pointer ]) =
23- const expectedConfigTable = {" 0" : " zero" , " 1" : " one" , " 2" : " two" }.toTable
23+ const expectedConfigList =
24+ @ [" -config=a" , " --singleconfig" , " -abbrev" , " -abbrevArg=arg" ]
2425
2526 let p = channel[].recv ()
2627
27- let configs = parseChannelData (p).valueOr:
28+ let configs = deserializeConfigArgs (p).valueOr:
2829 quit (QuitFailure )
2930
3031 isConfigRead.store (true )
31- checkResult[] = configs == expectedConfigTable
32+
33+ checkResult[] = configs == expectedConfigList
3234
3335# handles data for a given service
3436proc handlerService_2 (channel: ptr Channel [pointer ]) =
35- const expectedConfigTable = {" 4" : " four" , " 5" : " five" , " 6" : " " }.toTable
37+ const expectedConfigList =
38+ @ [" --singleconfig2" , " -config2=a2" , " -abbrev2" , " -abbrevArg2=arg2" ]
39+
3640 let p = channel[].recv ()
3741
38- let configs = parseChannelData (p).valueOr:
42+ let configs = deserializeConfigArgs (p).valueOr:
3943 quit (QuitFailure )
4044
4145 isConfigRead.store (true )
42- checkResult[] = configs == expectedConfigTable
46+
47+ checkResult[] = configs == expectedConfigList
4348
4449# ----------------------------------------------------------------------------
4550# # Unit Tests
@@ -50,8 +55,11 @@ suite "Nimbus Service Management":
5055 setup:
5156 nimbus = Nimbus .new
5257
53- const configTable_1 = {" 0" : " zero" , " 1" : " one" , " 2" : " two" }.toTable
54- const configTable_2 = {" 4" : " four" , " 5" : " five" , " 6" : " " }.toTable
58+ const configTable_1 =
59+ {" -config" : " =a" , " --singleconfig" : " " , " -abbrev" : " " , " -abbrevArg" : " =arg" }.toTable
60+ const configTable_2 = {
61+ " -config2" : " =a2" , " --singleconfig2" : " " , " -abbrev2" : " " , " -abbrevArg2" : " =arg2"
62+ }.toTable
5563
5664 # Test: Creating a new service successfully
5765 test " startService successfully adds a service" :
0 commit comments