github.com/getgauge/gauge@v1.6.9/gauge/scenario_test.go (about)

     1  /*----------------------------------------------------------------
     2   *  Copyright (c) ThoughtWorks, Inc.
     3   *  Licensed under the Apache License, Version 2.0
     4   *  See LICENSE in the project root for license information.
     5   *----------------------------------------------------------------*/
     6   package gauge
     7  
     8  import . "gopkg.in/check.v1"
     9  
    10  func (s *MySuite) TestUsesArgsInStep(c *C) {
    11  	stepArg := &StepArg{
    12  		Value:   "foo",
    13  		ArgType: Dynamic,
    14  	}
    15  	step1 := &Step{
    16  		Value:    "Some Step",
    17  		LineText: "abc <foo>",
    18  		Args:     []*StepArg{stepArg},
    19  	}
    20  	step2 := &Step{
    21  		Value:    "Some Step",
    22  		LineText: "abc",
    23  		Args:     []*StepArg{},
    24  	}
    25  	scenario := &Scenario{
    26  		Steps: []*Step{step1, step2},
    27  	}
    28  
    29  	c.Assert(scenario.UsesArgsInSteps("foo"), Equals, true)
    30  }
    31  
    32  func (s *MySuite) TestDoesNotUseDynamicArgsInStep(c *C) {
    33  	stepArg := &StepArg{
    34  		Value:   "foo",
    35  		ArgType: Static,
    36  	}
    37  
    38  	step1 := &Step{
    39  		Value:    "Some Step",
    40  		LineText: "abc <foo>",
    41  		Args:     []*StepArg{stepArg},
    42  	}
    43  	step2 := &Step{
    44  		Value:    "Some Step",
    45  		LineText: "abc",
    46  		Args:     []*StepArg{},
    47  	}
    48  	scenario := &Scenario{
    49  		Steps: []*Step{step1, step2},
    50  	}
    51  
    52  	c.Assert(scenario.UsesArgsInSteps("foo"), Equals, false)
    53  }
    54  
    55  func (s *MySuite) TestDoesNotUseArgsInStep(c *C) {
    56  	stepArg := &StepArg{
    57  		Value:   "abc",
    58  		ArgType: Dynamic,
    59  	}
    60  	step1 := &Step{
    61  		Value:    "Some Step",
    62  		LineText: "abc <foo>",
    63  		Args:     []*StepArg{stepArg},
    64  	}
    65  	step2 := &Step{
    66  		Value:    "Some Step",
    67  		LineText: "abc",
    68  		Args:     []*StepArg{},
    69  	}
    70  	scenario := &Scenario{
    71  		Steps: []*Step{step1, step2},
    72  	}
    73  
    74  	c.Assert(scenario.UsesArgsInSteps("foo"), Equals, false)
    75  }