@@ -485,3 +485,61 @@ let ``runBeforeEachStage and runAfterEachStage should work`` () =
485485 Assert.Equal( 4 , j)
486486 Assert.Equal( 3 , ti)
487487 Assert.Equal( 3 , tj)
488+
489+ [<Fact>]
490+ let ``check GetAllCmdArgs and RemainingArgs works when remaining args is not empty`` () =
491+ let mutable actualAllCmdArgs = []
492+ let mutable actualRemainingArgs = []
493+
494+ pipeline " demo" {
495+ cmdArgs [ " -p" ; " demo" ; " test1" ; " v1" ; " --" ; " test2" ; " v2" ]
496+ stage " shows arguments" {
497+ run ( fun ctx ->
498+ actualAllCmdArgs <- ctx.GetAllCmdArgs()
499+ actualRemainingArgs <- ctx.GetRemainingCmdArgs()
500+ )
501+ }
502+ runImmediate
503+ }
504+
505+ Assert.Equal< string list>([ " -p" ; " demo" ; " test1" ; " v1" ], actualAllCmdArgs)
506+ Assert.Equal< string list>([ " test2" ; " v2" ], actualRemainingArgs)
507+
508+ [<Fact>]
509+ let ``check GetAllCmdArgs and RemainingArgs works when remaining args is provided but empty`` () =
510+ let mutable actualAllCmdArgs = []
511+ let mutable actualRemainingArgs = []
512+
513+ pipeline " demo" {
514+ cmdArgs [ " -p" ; " demo" ; " test1" ; " v1" ; " --" ]
515+ stage " shows arguments" {
516+ run ( fun ctx ->
517+ actualAllCmdArgs <- ctx.GetAllCmdArgs()
518+ actualRemainingArgs <- ctx.GetRemainingCmdArgs()
519+ )
520+ }
521+ runImmediate
522+ }
523+
524+ Assert.Equal< string list>([ " -p" ; " demo" ; " test1" ; " v1" ], actualAllCmdArgs)
525+ Assert.Equal< string list>([], actualRemainingArgs)
526+
527+
528+ [<Fact>]
529+ let ``check GetAllCmdArgs and RemainingArgs works when remaining args is not provided`` () =
530+ let mutable actualAllCmdArgs = []
531+ let mutable actualRemainingArgs = []
532+
533+ pipeline " demo" {
534+ cmdArgs [ " -p" ; " demo" ; " test1" ; " v1" ]
535+ stage " shows arguments" {
536+ run ( fun ctx ->
537+ actualAllCmdArgs <- ctx.GetAllCmdArgs()
538+ actualRemainingArgs <- ctx.GetRemainingCmdArgs()
539+ )
540+ }
541+ runImmediate
542+ }
543+
544+ Assert.Equal< string list>([ " -p" ; " demo" ; " test1" ; " v1" ], actualAllCmdArgs)
545+ Assert.Equal< string list>([], actualRemainingArgs)
0 commit comments