github.com/mattdotmatt/gauge@v0.3.2-0.20160421115137-425a4cdccb62/gauge/concept_test.go (about) 1 // Copyright 2015 ThoughtWorks, Inc. 2 3 // This file is part of Gauge. 4 5 // Gauge is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 10 // Gauge is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 15 // You should have received a copy of the GNU General Public License 16 // along with Gauge. If not, see <http://www.gnu.org/licenses/>. 17 18 package gauge 19 20 import . "gopkg.in/check.v1" 21 22 func (s *MySuite) TestDeepCopyOfConcept(c *C) { 23 step := &Step{Value: "test concept step 1", 24 LineText: "dsfdsfdsf", 25 IsConcept: true, LineNo: 2, 26 ConceptSteps: []*Step{ 27 &Step{Value: "sfd", 28 LineText: "sfd", 29 IsConcept: false}, 30 &Step{Value: "sdfsdf" + "T", 31 LineText: "sdfsdf" + "T", 32 IsConcept: false}}} 33 34 concept := &Concept{ConceptStep: step, FileName: "file.cpt"} 35 36 copiedTopLevelConcept := concept.deepCopy() 37 verifyCopiedConcept(copiedTopLevelConcept, concept, c) 38 } 39 40 func verifyCopiedConcept(copiedConcept *Concept, actualConcept *Concept, c *C) { 41 c.Assert(&copiedConcept, Not(Equals), &actualConcept) 42 c.Assert(copiedConcept, DeepEquals, actualConcept) 43 }