How to use run method of main Package

Best Mock code snippet using main.run

CT_BdoContentRun.go

Source:CT_BdoContentRun.go Github

copy

Full Screen

...92 if err := d.DecodeElement(m.SubDoc, &el); err != nil {93 return err94 }95 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXml"}:96 tmpcontentruncontent := NewEG_ContentRunContent()97 tmpcontentruncontent.CustomXml = NewCT_CustomXmlRun()98 if err := d.DecodeElement(tmpcontentruncontent.CustomXml, &el); err != nil {99 return err100 }101 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)102 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "smartTag"}:103 tmpcontentruncontent := NewEG_ContentRunContent()104 tmpcontentruncontent.SmartTag = NewCT_SmartTagRun()105 if err := d.DecodeElement(tmpcontentruncontent.SmartTag, &el); err != nil {106 return err107 }108 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)109 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sdt"}:110 tmpcontentruncontent := NewEG_ContentRunContent()111 tmpcontentruncontent.Sdt = NewCT_SdtRun()112 if err := d.DecodeElement(tmpcontentruncontent.Sdt, &el); err != nil {113 return err114 }115 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)116 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dir"}:117 tmpcontentruncontent := NewEG_ContentRunContent()118 tmpcontentruncontent.Dir = NewCT_DirContentRun()119 if err := d.DecodeElement(tmpcontentruncontent.Dir, &el); err != nil {120 return err121 }122 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)123 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bdo"}:124 tmpcontentruncontent := NewEG_ContentRunContent()125 tmpcontentruncontent.Bdo = NewCT_BdoContentRun()126 if err := d.DecodeElement(tmpcontentruncontent.Bdo, &el); err != nil {127 return err128 }129 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)130 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "r"}:131 tmpcontentruncontent := NewEG_ContentRunContent()132 tmpcontentruncontent.R = NewCT_R()133 if err := d.DecodeElement(tmpcontentruncontent.R, &el); err != nil {134 return err135 }136 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)137 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "proofErr"}:138 tmpcontentruncontent := NewEG_ContentRunContent()139 tmprunlevelelts := NewEG_RunLevelElts()140 tmprunlevelelts.ProofErr = NewCT_ProofErr()141 if err := d.DecodeElement(tmprunlevelelts.ProofErr, &el); err != nil {142 return err143 }144 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)145 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)146 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permStart"}:147 tmpcontentruncontent := NewEG_ContentRunContent()148 tmprunlevelelts := NewEG_RunLevelElts()149 tmprunlevelelts.PermStart = NewCT_PermStart()150 if err := d.DecodeElement(tmprunlevelelts.PermStart, &el); err != nil {151 return err152 }153 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)154 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)155 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permEnd"}:156 tmpcontentruncontent := NewEG_ContentRunContent()157 tmprunlevelelts := NewEG_RunLevelElts()158 tmprunlevelelts.PermEnd = NewCT_Perm()159 if err := d.DecodeElement(tmprunlevelelts.PermEnd, &el); err != nil {160 return err161 }162 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)163 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)164 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ins"}:165 tmpcontentruncontent := NewEG_ContentRunContent()166 tmprunlevelelts := NewEG_RunLevelElts()167 tmprunlevelelts.Ins = NewCT_RunTrackChange()168 if err := d.DecodeElement(tmprunlevelelts.Ins, &el); err != nil {169 return err170 }171 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)172 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)173 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "del"}:174 tmpcontentruncontent := NewEG_ContentRunContent()175 tmprunlevelelts := NewEG_RunLevelElts()176 tmprunlevelelts.Del = NewCT_RunTrackChange()177 if err := d.DecodeElement(tmprunlevelelts.Del, &el); err != nil {178 return err179 }180 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)181 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)182 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFrom"}:183 tmpcontentruncontent := NewEG_ContentRunContent()184 tmprunlevelelts := NewEG_RunLevelElts()185 tmprunlevelelts.MoveFrom = NewCT_RunTrackChange()186 if err := d.DecodeElement(tmprunlevelelts.MoveFrom, &el); err != nil {187 return err188 }189 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)190 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)191 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveTo"}:192 tmpcontentruncontent := NewEG_ContentRunContent()193 tmprunlevelelts := NewEG_RunLevelElts()194 tmprunlevelelts.MoveTo = NewCT_RunTrackChange()195 if err := d.DecodeElement(tmprunlevelelts.MoveTo, &el); err != nil {196 return err197 }198 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)199 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)200 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkStart"}:201 tmpcontentruncontent := NewEG_ContentRunContent()202 tmprunlevelelts := NewEG_RunLevelElts()203 tmprangemarkupelements := NewEG_RangeMarkupElements()204 tmprangemarkupelements.BookmarkStart = NewCT_Bookmark()205 if err := d.DecodeElement(tmprangemarkupelements.BookmarkStart, &el); err != nil {206 return err207 }208 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)209 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)210 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)211 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkEnd"}:212 tmpcontentruncontent := NewEG_ContentRunContent()213 tmprunlevelelts := NewEG_RunLevelElts()214 tmprangemarkupelements := NewEG_RangeMarkupElements()215 tmprangemarkupelements.BookmarkEnd = NewCT_MarkupRange()216 if err := d.DecodeElement(tmprangemarkupelements.BookmarkEnd, &el); err != nil {217 return err218 }219 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)220 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)221 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)222 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeStart"}:223 tmpcontentruncontent := NewEG_ContentRunContent()224 tmprunlevelelts := NewEG_RunLevelElts()225 tmprangemarkupelements := NewEG_RangeMarkupElements()226 tmprangemarkupelements.MoveFromRangeStart = NewCT_MoveBookmark()227 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeStart, &el); err != nil {228 return err229 }230 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)231 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)232 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)233 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeEnd"}:234 tmpcontentruncontent := NewEG_ContentRunContent()235 tmprunlevelelts := NewEG_RunLevelElts()236 tmprangemarkupelements := NewEG_RangeMarkupElements()237 tmprangemarkupelements.MoveFromRangeEnd = NewCT_MarkupRange()238 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeEnd, &el); err != nil {239 return err240 }241 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)242 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)243 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)244 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeStart"}:245 tmpcontentruncontent := NewEG_ContentRunContent()246 tmprunlevelelts := NewEG_RunLevelElts()247 tmprangemarkupelements := NewEG_RangeMarkupElements()248 tmprangemarkupelements.MoveToRangeStart = NewCT_MoveBookmark()249 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeStart, &el); err != nil {250 return err251 }252 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)253 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)254 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)255 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeEnd"}:256 tmpcontentruncontent := NewEG_ContentRunContent()257 tmprunlevelelts := NewEG_RunLevelElts()258 tmprangemarkupelements := NewEG_RangeMarkupElements()259 tmprangemarkupelements.MoveToRangeEnd = NewCT_MarkupRange()260 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeEnd, &el); err != nil {261 return err262 }263 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)264 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)265 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)266 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeStart"}:267 tmpcontentruncontent := NewEG_ContentRunContent()268 tmprunlevelelts := NewEG_RunLevelElts()269 tmprangemarkupelements := NewEG_RangeMarkupElements()270 tmprangemarkupelements.CommentRangeStart = NewCT_MarkupRange()271 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeStart, &el); err != nil {272 return err273 }274 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)275 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)276 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)277 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeEnd"}:278 tmpcontentruncontent := NewEG_ContentRunContent()279 tmprunlevelelts := NewEG_RunLevelElts()280 tmprangemarkupelements := NewEG_RangeMarkupElements()281 tmprangemarkupelements.CommentRangeEnd = NewCT_MarkupRange()282 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeEnd, &el); err != nil {283 return err284 }285 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)286 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)287 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)288 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeStart"}:289 tmpcontentruncontent := NewEG_ContentRunContent()290 tmprunlevelelts := NewEG_RunLevelElts()291 tmprangemarkupelements := NewEG_RangeMarkupElements()292 tmprangemarkupelements.CustomXmlInsRangeStart = NewCT_TrackChange()293 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeStart, &el); err != nil {294 return err295 }296 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)297 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)298 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)299 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeEnd"}:300 tmpcontentruncontent := NewEG_ContentRunContent()301 tmprunlevelelts := NewEG_RunLevelElts()302 tmprangemarkupelements := NewEG_RangeMarkupElements()303 tmprangemarkupelements.CustomXmlInsRangeEnd = NewCT_Markup()304 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeEnd, &el); err != nil {305 return err306 }307 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)308 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)309 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)310 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeStart"}:311 tmpcontentruncontent := NewEG_ContentRunContent()312 tmprunlevelelts := NewEG_RunLevelElts()313 tmprangemarkupelements := NewEG_RangeMarkupElements()314 tmprangemarkupelements.CustomXmlDelRangeStart = NewCT_TrackChange()315 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeStart, &el); err != nil {316 return err317 }318 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)319 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)320 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)321 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeEnd"}:322 tmpcontentruncontent := NewEG_ContentRunContent()323 tmprunlevelelts := NewEG_RunLevelElts()324 tmprangemarkupelements := NewEG_RangeMarkupElements()325 tmprangemarkupelements.CustomXmlDelRangeEnd = NewCT_Markup()326 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeEnd, &el); err != nil {327 return err328 }329 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)330 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)331 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)332 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeStart"}:333 tmpcontentruncontent := NewEG_ContentRunContent()334 tmprunlevelelts := NewEG_RunLevelElts()335 tmprangemarkupelements := NewEG_RangeMarkupElements()336 tmprangemarkupelements.CustomXmlMoveFromRangeStart = NewCT_TrackChange()337 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeStart, &el); err != nil {338 return err339 }340 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)341 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)342 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)343 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeEnd"}:344 tmpcontentruncontent := NewEG_ContentRunContent()345 tmprunlevelelts := NewEG_RunLevelElts()346 tmprangemarkupelements := NewEG_RangeMarkupElements()347 tmprangemarkupelements.CustomXmlMoveFromRangeEnd = NewCT_Markup()348 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeEnd, &el); err != nil {349 return err350 }351 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)352 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)353 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)354 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeStart"}:355 tmpcontentruncontent := NewEG_ContentRunContent()356 tmprunlevelelts := NewEG_RunLevelElts()357 tmprangemarkupelements := NewEG_RangeMarkupElements()358 tmprangemarkupelements.CustomXmlMoveToRangeStart = NewCT_TrackChange()359 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeStart, &el); err != nil {360 return err361 }362 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)363 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)364 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)365 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeEnd"}:366 tmpcontentruncontent := NewEG_ContentRunContent()367 tmprunlevelelts := NewEG_RunLevelElts()368 tmprangemarkupelements := NewEG_RangeMarkupElements()369 tmprangemarkupelements.CustomXmlMoveToRangeEnd = NewCT_Markup()370 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeEnd, &el); err != nil {371 return err372 }373 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)374 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)375 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)376 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMathPara"}:377 tmpcontentruncontent := NewEG_ContentRunContent()378 tmprunlevelelts := NewEG_RunLevelElts()379 tmpmathcontent := NewEG_MathContent()380 tmpmathcontent.OMathPara = math.NewOMathPara()381 if err := d.DecodeElement(tmpmathcontent.OMathPara, &el); err != nil {382 return err383 }384 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)385 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)386 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)387 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMath"}:388 tmpcontentruncontent := NewEG_ContentRunContent()389 tmprunlevelelts := NewEG_RunLevelElts()390 tmpmathcontent := NewEG_MathContent()391 tmpmathcontent.OMath = math.NewOMath()392 if err := d.DecodeElement(tmpmathcontent.OMath, &el); err != nil {393 return err394 }395 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)396 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)397 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)398 default:399 gooxml.Log("skipping unsupported element on CT_BdoContentRun %v", el.Name)400 if err := d.Skip(); err != nil {401 return err402 }403 }404 case xml.EndElement:405 break lCT_BdoContentRun406 case xml.CharData:407 }408 }409 return nil410}411// Validate validates the CT_BdoContentRun and its children...

Full Screen

Full Screen

CT_SdtContentRun.go

Source:CT_SdtContentRun.go Github

copy

Full Screen

...77 if err := d.DecodeElement(m.SubDoc, &el); err != nil {78 return err79 }80 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXml"}:81 tmpcontentruncontent := NewEG_ContentRunContent()82 tmpcontentruncontent.CustomXml = NewCT_CustomXmlRun()83 if err := d.DecodeElement(tmpcontentruncontent.CustomXml, &el); err != nil {84 return err85 }86 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)87 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "smartTag"}:88 tmpcontentruncontent := NewEG_ContentRunContent()89 tmpcontentruncontent.SmartTag = NewCT_SmartTagRun()90 if err := d.DecodeElement(tmpcontentruncontent.SmartTag, &el); err != nil {91 return err92 }93 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)94 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sdt"}:95 tmpcontentruncontent := NewEG_ContentRunContent()96 tmpcontentruncontent.Sdt = NewCT_SdtRun()97 if err := d.DecodeElement(tmpcontentruncontent.Sdt, &el); err != nil {98 return err99 }100 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)101 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dir"}:102 tmpcontentruncontent := NewEG_ContentRunContent()103 tmpcontentruncontent.Dir = NewCT_DirContentRun()104 if err := d.DecodeElement(tmpcontentruncontent.Dir, &el); err != nil {105 return err106 }107 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)108 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bdo"}:109 tmpcontentruncontent := NewEG_ContentRunContent()110 tmpcontentruncontent.Bdo = NewCT_BdoContentRun()111 if err := d.DecodeElement(tmpcontentruncontent.Bdo, &el); err != nil {112 return err113 }114 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)115 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "r"}:116 tmpcontentruncontent := NewEG_ContentRunContent()117 tmpcontentruncontent.R = NewCT_R()118 if err := d.DecodeElement(tmpcontentruncontent.R, &el); err != nil {119 return err120 }121 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)122 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "proofErr"}:123 tmpcontentruncontent := NewEG_ContentRunContent()124 tmprunlevelelts := NewEG_RunLevelElts()125 tmprunlevelelts.ProofErr = NewCT_ProofErr()126 if err := d.DecodeElement(tmprunlevelelts.ProofErr, &el); err != nil {127 return err128 }129 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)130 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)131 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permStart"}:132 tmpcontentruncontent := NewEG_ContentRunContent()133 tmprunlevelelts := NewEG_RunLevelElts()134 tmprunlevelelts.PermStart = NewCT_PermStart()135 if err := d.DecodeElement(tmprunlevelelts.PermStart, &el); err != nil {136 return err137 }138 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)139 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)140 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "permEnd"}:141 tmpcontentruncontent := NewEG_ContentRunContent()142 tmprunlevelelts := NewEG_RunLevelElts()143 tmprunlevelelts.PermEnd = NewCT_Perm()144 if err := d.DecodeElement(tmprunlevelelts.PermEnd, &el); err != nil {145 return err146 }147 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)148 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)149 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ins"}:150 tmpcontentruncontent := NewEG_ContentRunContent()151 tmprunlevelelts := NewEG_RunLevelElts()152 tmprunlevelelts.Ins = NewCT_RunTrackChange()153 if err := d.DecodeElement(tmprunlevelelts.Ins, &el); err != nil {154 return err155 }156 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)157 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)158 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "del"}:159 tmpcontentruncontent := NewEG_ContentRunContent()160 tmprunlevelelts := NewEG_RunLevelElts()161 tmprunlevelelts.Del = NewCT_RunTrackChange()162 if err := d.DecodeElement(tmprunlevelelts.Del, &el); err != nil {163 return err164 }165 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)166 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)167 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFrom"}:168 tmpcontentruncontent := NewEG_ContentRunContent()169 tmprunlevelelts := NewEG_RunLevelElts()170 tmprunlevelelts.MoveFrom = NewCT_RunTrackChange()171 if err := d.DecodeElement(tmprunlevelelts.MoveFrom, &el); err != nil {172 return err173 }174 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)175 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)176 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveTo"}:177 tmpcontentruncontent := NewEG_ContentRunContent()178 tmprunlevelelts := NewEG_RunLevelElts()179 tmprunlevelelts.MoveTo = NewCT_RunTrackChange()180 if err := d.DecodeElement(tmprunlevelelts.MoveTo, &el); err != nil {181 return err182 }183 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)184 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)185 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkStart"}:186 tmpcontentruncontent := NewEG_ContentRunContent()187 tmprunlevelelts := NewEG_RunLevelElts()188 tmprangemarkupelements := NewEG_RangeMarkupElements()189 tmprangemarkupelements.BookmarkStart = NewCT_Bookmark()190 if err := d.DecodeElement(tmprangemarkupelements.BookmarkStart, &el); err != nil {191 return err192 }193 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)194 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)195 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)196 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "bookmarkEnd"}:197 tmpcontentruncontent := NewEG_ContentRunContent()198 tmprunlevelelts := NewEG_RunLevelElts()199 tmprangemarkupelements := NewEG_RangeMarkupElements()200 tmprangemarkupelements.BookmarkEnd = NewCT_MarkupRange()201 if err := d.DecodeElement(tmprangemarkupelements.BookmarkEnd, &el); err != nil {202 return err203 }204 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)205 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)206 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)207 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeStart"}:208 tmpcontentruncontent := NewEG_ContentRunContent()209 tmprunlevelelts := NewEG_RunLevelElts()210 tmprangemarkupelements := NewEG_RangeMarkupElements()211 tmprangemarkupelements.MoveFromRangeStart = NewCT_MoveBookmark()212 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeStart, &el); err != nil {213 return err214 }215 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)216 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)217 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)218 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveFromRangeEnd"}:219 tmpcontentruncontent := NewEG_ContentRunContent()220 tmprunlevelelts := NewEG_RunLevelElts()221 tmprangemarkupelements := NewEG_RangeMarkupElements()222 tmprangemarkupelements.MoveFromRangeEnd = NewCT_MarkupRange()223 if err := d.DecodeElement(tmprangemarkupelements.MoveFromRangeEnd, &el); err != nil {224 return err225 }226 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)227 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)228 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)229 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeStart"}:230 tmpcontentruncontent := NewEG_ContentRunContent()231 tmprunlevelelts := NewEG_RunLevelElts()232 tmprangemarkupelements := NewEG_RangeMarkupElements()233 tmprangemarkupelements.MoveToRangeStart = NewCT_MoveBookmark()234 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeStart, &el); err != nil {235 return err236 }237 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)238 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)239 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)240 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "moveToRangeEnd"}:241 tmpcontentruncontent := NewEG_ContentRunContent()242 tmprunlevelelts := NewEG_RunLevelElts()243 tmprangemarkupelements := NewEG_RangeMarkupElements()244 tmprangemarkupelements.MoveToRangeEnd = NewCT_MarkupRange()245 if err := d.DecodeElement(tmprangemarkupelements.MoveToRangeEnd, &el); err != nil {246 return err247 }248 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)249 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)250 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)251 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeStart"}:252 tmpcontentruncontent := NewEG_ContentRunContent()253 tmprunlevelelts := NewEG_RunLevelElts()254 tmprangemarkupelements := NewEG_RangeMarkupElements()255 tmprangemarkupelements.CommentRangeStart = NewCT_MarkupRange()256 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeStart, &el); err != nil {257 return err258 }259 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)260 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)261 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)262 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentRangeEnd"}:263 tmpcontentruncontent := NewEG_ContentRunContent()264 tmprunlevelelts := NewEG_RunLevelElts()265 tmprangemarkupelements := NewEG_RangeMarkupElements()266 tmprangemarkupelements.CommentRangeEnd = NewCT_MarkupRange()267 if err := d.DecodeElement(tmprangemarkupelements.CommentRangeEnd, &el); err != nil {268 return err269 }270 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)271 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)272 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)273 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeStart"}:274 tmpcontentruncontent := NewEG_ContentRunContent()275 tmprunlevelelts := NewEG_RunLevelElts()276 tmprangemarkupelements := NewEG_RangeMarkupElements()277 tmprangemarkupelements.CustomXmlInsRangeStart = NewCT_TrackChange()278 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeStart, &el); err != nil {279 return err280 }281 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)282 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)283 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)284 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlInsRangeEnd"}:285 tmpcontentruncontent := NewEG_ContentRunContent()286 tmprunlevelelts := NewEG_RunLevelElts()287 tmprangemarkupelements := NewEG_RangeMarkupElements()288 tmprangemarkupelements.CustomXmlInsRangeEnd = NewCT_Markup()289 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlInsRangeEnd, &el); err != nil {290 return err291 }292 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)293 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)294 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)295 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeStart"}:296 tmpcontentruncontent := NewEG_ContentRunContent()297 tmprunlevelelts := NewEG_RunLevelElts()298 tmprangemarkupelements := NewEG_RangeMarkupElements()299 tmprangemarkupelements.CustomXmlDelRangeStart = NewCT_TrackChange()300 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeStart, &el); err != nil {301 return err302 }303 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)304 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)305 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)306 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlDelRangeEnd"}:307 tmpcontentruncontent := NewEG_ContentRunContent()308 tmprunlevelelts := NewEG_RunLevelElts()309 tmprangemarkupelements := NewEG_RangeMarkupElements()310 tmprangemarkupelements.CustomXmlDelRangeEnd = NewCT_Markup()311 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlDelRangeEnd, &el); err != nil {312 return err313 }314 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)315 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)316 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)317 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeStart"}:318 tmpcontentruncontent := NewEG_ContentRunContent()319 tmprunlevelelts := NewEG_RunLevelElts()320 tmprangemarkupelements := NewEG_RangeMarkupElements()321 tmprangemarkupelements.CustomXmlMoveFromRangeStart = NewCT_TrackChange()322 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeStart, &el); err != nil {323 return err324 }325 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)326 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)327 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)328 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveFromRangeEnd"}:329 tmpcontentruncontent := NewEG_ContentRunContent()330 tmprunlevelelts := NewEG_RunLevelElts()331 tmprangemarkupelements := NewEG_RangeMarkupElements()332 tmprangemarkupelements.CustomXmlMoveFromRangeEnd = NewCT_Markup()333 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveFromRangeEnd, &el); err != nil {334 return err335 }336 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)337 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)338 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)339 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeStart"}:340 tmpcontentruncontent := NewEG_ContentRunContent()341 tmprunlevelelts := NewEG_RunLevelElts()342 tmprangemarkupelements := NewEG_RangeMarkupElements()343 tmprangemarkupelements.CustomXmlMoveToRangeStart = NewCT_TrackChange()344 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeStart, &el); err != nil {345 return err346 }347 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)348 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)349 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)350 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "customXmlMoveToRangeEnd"}:351 tmpcontentruncontent := NewEG_ContentRunContent()352 tmprunlevelelts := NewEG_RunLevelElts()353 tmprangemarkupelements := NewEG_RangeMarkupElements()354 tmprangemarkupelements.CustomXmlMoveToRangeEnd = NewCT_Markup()355 if err := d.DecodeElement(tmprangemarkupelements.CustomXmlMoveToRangeEnd, &el); err != nil {356 return err357 }358 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)359 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)360 tmprunlevelelts.EG_RangeMarkupElements = append(tmprunlevelelts.EG_RangeMarkupElements, tmprangemarkupelements)361 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMathPara"}:362 tmpcontentruncontent := NewEG_ContentRunContent()363 tmprunlevelelts := NewEG_RunLevelElts()364 tmpmathcontent := NewEG_MathContent()365 tmpmathcontent.OMathPara = math.NewOMathPara()366 if err := d.DecodeElement(tmpmathcontent.OMathPara, &el); err != nil {367 return err368 }369 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)370 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)371 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)372 case xml.Name{Space: "http://schemas.openxmlformats.org/officeDocument/2006/math", Local: "oMath"}:373 tmpcontentruncontent := NewEG_ContentRunContent()374 tmprunlevelelts := NewEG_RunLevelElts()375 tmpmathcontent := NewEG_MathContent()376 tmpmathcontent.OMath = math.NewOMath()377 if err := d.DecodeElement(tmpmathcontent.OMath, &el); err != nil {378 return err379 }380 m.EG_ContentRunContent = append(m.EG_ContentRunContent, tmpcontentruncontent)381 tmpcontentruncontent.EG_RunLevelElts = append(tmpcontentruncontent.EG_RunLevelElts, tmprunlevelelts)382 tmprunlevelelts.EG_MathContent = append(tmprunlevelelts.EG_MathContent, tmpmathcontent)383 default:384 gooxml.Log("skipping unsupported element on CT_SdtContentRun %v", el.Name)385 if err := d.Skip(); err != nil {386 return err387 }388 }389 case xml.EndElement:390 break lCT_SdtContentRun391 case xml.CharData:392 }393 }394 return nil395}396// Validate validates the CT_SdtContentRun and its children...

Full Screen

Full Screen

CT_R.go

Source:CT_R.go Github

copy

Full Screen

...101 if err := d.DecodeElement(m.RPr, &el); err != nil {102 return err103 }104 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "br"}:105 tmpruninnercontent := NewEG_RunInnerContent()106 tmpruninnercontent.Br = NewCT_Br()107 if err := d.DecodeElement(tmpruninnercontent.Br, &el); err != nil {108 return err109 }110 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)111 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "t"}:112 tmpruninnercontent := NewEG_RunInnerContent()113 tmpruninnercontent.T = NewCT_Text()114 if err := d.DecodeElement(tmpruninnercontent.T, &el); err != nil {115 return err116 }117 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)118 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "contentPart"}:119 tmpruninnercontent := NewEG_RunInnerContent()120 tmpruninnercontent.ContentPart = NewCT_Rel()121 if err := d.DecodeElement(tmpruninnercontent.ContentPart, &el); err != nil {122 return err123 }124 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)125 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "delText"}:126 tmpruninnercontent := NewEG_RunInnerContent()127 tmpruninnercontent.DelText = NewCT_Text()128 if err := d.DecodeElement(tmpruninnercontent.DelText, &el); err != nil {129 return err130 }131 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)132 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "instrText"}:133 tmpruninnercontent := NewEG_RunInnerContent()134 tmpruninnercontent.InstrText = NewCT_Text()135 if err := d.DecodeElement(tmpruninnercontent.InstrText, &el); err != nil {136 return err137 }138 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)139 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "delInstrText"}:140 tmpruninnercontent := NewEG_RunInnerContent()141 tmpruninnercontent.DelInstrText = NewCT_Text()142 if err := d.DecodeElement(tmpruninnercontent.DelInstrText, &el); err != nil {143 return err144 }145 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)146 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "noBreakHyphen"}:147 tmpruninnercontent := NewEG_RunInnerContent()148 tmpruninnercontent.NoBreakHyphen = NewCT_Empty()149 if err := d.DecodeElement(tmpruninnercontent.NoBreakHyphen, &el); err != nil {150 return err151 }152 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)153 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "softHyphen"}:154 tmpruninnercontent := NewEG_RunInnerContent()155 tmpruninnercontent.SoftHyphen = NewCT_Empty()156 if err := d.DecodeElement(tmpruninnercontent.SoftHyphen, &el); err != nil {157 return err158 }159 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)160 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dayShort"}:161 tmpruninnercontent := NewEG_RunInnerContent()162 tmpruninnercontent.DayShort = NewCT_Empty()163 if err := d.DecodeElement(tmpruninnercontent.DayShort, &el); err != nil {164 return err165 }166 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)167 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "monthShort"}:168 tmpruninnercontent := NewEG_RunInnerContent()169 tmpruninnercontent.MonthShort = NewCT_Empty()170 if err := d.DecodeElement(tmpruninnercontent.MonthShort, &el); err != nil {171 return err172 }173 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)174 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "yearShort"}:175 tmpruninnercontent := NewEG_RunInnerContent()176 tmpruninnercontent.YearShort = NewCT_Empty()177 if err := d.DecodeElement(tmpruninnercontent.YearShort, &el); err != nil {178 return err179 }180 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)181 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "dayLong"}:182 tmpruninnercontent := NewEG_RunInnerContent()183 tmpruninnercontent.DayLong = NewCT_Empty()184 if err := d.DecodeElement(tmpruninnercontent.DayLong, &el); err != nil {185 return err186 }187 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)188 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "monthLong"}:189 tmpruninnercontent := NewEG_RunInnerContent()190 tmpruninnercontent.MonthLong = NewCT_Empty()191 if err := d.DecodeElement(tmpruninnercontent.MonthLong, &el); err != nil {192 return err193 }194 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)195 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "yearLong"}:196 tmpruninnercontent := NewEG_RunInnerContent()197 tmpruninnercontent.YearLong = NewCT_Empty()198 if err := d.DecodeElement(tmpruninnercontent.YearLong, &el); err != nil {199 return err200 }201 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)202 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "annotationRef"}:203 tmpruninnercontent := NewEG_RunInnerContent()204 tmpruninnercontent.AnnotationRef = NewCT_Empty()205 if err := d.DecodeElement(tmpruninnercontent.AnnotationRef, &el); err != nil {206 return err207 }208 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)209 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "footnoteRef"}:210 tmpruninnercontent := NewEG_RunInnerContent()211 tmpruninnercontent.FootnoteRef = NewCT_Empty()212 if err := d.DecodeElement(tmpruninnercontent.FootnoteRef, &el); err != nil {213 return err214 }215 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)216 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "endnoteRef"}:217 tmpruninnercontent := NewEG_RunInnerContent()218 tmpruninnercontent.EndnoteRef = NewCT_Empty()219 if err := d.DecodeElement(tmpruninnercontent.EndnoteRef, &el); err != nil {220 return err221 }222 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)223 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "separator"}:224 tmpruninnercontent := NewEG_RunInnerContent()225 tmpruninnercontent.Separator = NewCT_Empty()226 if err := d.DecodeElement(tmpruninnercontent.Separator, &el); err != nil {227 return err228 }229 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)230 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "continuationSeparator"}:231 tmpruninnercontent := NewEG_RunInnerContent()232 tmpruninnercontent.ContinuationSeparator = NewCT_Empty()233 if err := d.DecodeElement(tmpruninnercontent.ContinuationSeparator, &el); err != nil {234 return err235 }236 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)237 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "sym"}:238 tmpruninnercontent := NewEG_RunInnerContent()239 tmpruninnercontent.Sym = NewCT_Sym()240 if err := d.DecodeElement(tmpruninnercontent.Sym, &el); err != nil {241 return err242 }243 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)244 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pgNum"}:245 tmpruninnercontent := NewEG_RunInnerContent()246 tmpruninnercontent.PgNum = NewCT_Empty()247 if err := d.DecodeElement(tmpruninnercontent.PgNum, &el); err != nil {248 return err249 }250 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)251 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "cr"}:252 tmpruninnercontent := NewEG_RunInnerContent()253 tmpruninnercontent.Cr = NewCT_Empty()254 if err := d.DecodeElement(tmpruninnercontent.Cr, &el); err != nil {255 return err256 }257 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)258 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "tab"}:259 tmpruninnercontent := NewEG_RunInnerContent()260 tmpruninnercontent.Tab = NewCT_Empty()261 if err := d.DecodeElement(tmpruninnercontent.Tab, &el); err != nil {262 return err263 }264 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)265 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "object"}:266 tmpruninnercontent := NewEG_RunInnerContent()267 tmpruninnercontent.Object = NewCT_Object()268 if err := d.DecodeElement(tmpruninnercontent.Object, &el); err != nil {269 return err270 }271 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)272 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "pict"}:273 tmpruninnercontent := NewEG_RunInnerContent()274 tmpruninnercontent.Pict = NewCT_Picture()275 if err := d.DecodeElement(tmpruninnercontent.Pict, &el); err != nil {276 return err277 }278 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)279 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "fldChar"}:280 tmpruninnercontent := NewEG_RunInnerContent()281 tmpruninnercontent.FldChar = NewCT_FldChar()282 if err := d.DecodeElement(tmpruninnercontent.FldChar, &el); err != nil {283 return err284 }285 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)286 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ruby"}:287 tmpruninnercontent := NewEG_RunInnerContent()288 tmpruninnercontent.Ruby = NewCT_Ruby()289 if err := d.DecodeElement(tmpruninnercontent.Ruby, &el); err != nil {290 return err291 }292 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)293 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "footnoteReference"}:294 tmpruninnercontent := NewEG_RunInnerContent()295 tmpruninnercontent.FootnoteReference = NewCT_FtnEdnRef()296 if err := d.DecodeElement(tmpruninnercontent.FootnoteReference, &el); err != nil {297 return err298 }299 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)300 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "endnoteReference"}:301 tmpruninnercontent := NewEG_RunInnerContent()302 tmpruninnercontent.EndnoteReference = NewCT_FtnEdnRef()303 if err := d.DecodeElement(tmpruninnercontent.EndnoteReference, &el); err != nil {304 return err305 }306 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)307 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "commentReference"}:308 tmpruninnercontent := NewEG_RunInnerContent()309 tmpruninnercontent.CommentReference = NewCT_Markup()310 if err := d.DecodeElement(tmpruninnercontent.CommentReference, &el); err != nil {311 return err312 }313 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)314 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "drawing"}:315 tmpruninnercontent := NewEG_RunInnerContent()316 tmpruninnercontent.Drawing = NewCT_Drawing()317 if err := d.DecodeElement(tmpruninnercontent.Drawing, &el); err != nil {318 return err319 }320 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)321 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "ptab"}:322 tmpruninnercontent := NewEG_RunInnerContent()323 tmpruninnercontent.Ptab = NewCT_PTab()324 if err := d.DecodeElement(tmpruninnercontent.Ptab, &el); err != nil {325 return err326 }327 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)328 case xml.Name{Space: "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Local: "lastRenderedPageBreak"}:329 tmpruninnercontent := NewEG_RunInnerContent()330 tmpruninnercontent.LastRenderedPageBreak = NewCT_Empty()331 if err := d.DecodeElement(tmpruninnercontent.LastRenderedPageBreak, &el); err != nil {332 return err333 }334 m.EG_RunInnerContent = append(m.EG_RunInnerContent, tmpruninnercontent)335 default:336 any := &gooxml.XSDAny{}337 if err := d.DecodeElement(any, &el); err != nil {338 return err339 }340 m.Extra = append(m.Extra, any)341 }342 case xml.EndElement:343 break lCT_R344 case xml.CharData:345 }346 }347 return nil348}...

Full Screen

Full Screen

strategy_cover_test.go

Source:strategy_cover_test.go Github

copy

Full Screen

...10 "testing"11)12func TestCoverStrategyTestsToRun(t *testing.T) {13 var (14 gomod = []byte(`module cover-strategy-test-run15 go 1.1316 `)17 mainFile = []byte(`package main18 import (19 "fmt"20 "cover-strategy-test-run/pkga"21 )22 var a, b int = 10, 2023 func main() {24 fmt.Printf("%+v\n", add(a, b))25 }26 func sub(a, b int) int {27 return pkga.Sub(a, b)28 }29 `)30 fileA = []byte(`package main31 func add(a, b int) int {32 return a + b33 }34 func mul(a, b int) int {35 return a * b36 }37 `)38 mainTestFile = []byte(`package main39 import (40 "testing"41 )42 func TestAdd(t *testing.T) {43 if add(3, 4) != 7 {44 t.Error("add unexpected result")45 }46 }47 func TestMul(t *testing.T) {48 if mul(10, 5) != 50 {49 t.Error("mul unexpected result")50 }51 }52 `)53 pkgAFileA = []byte(`package pkga54 func Div(a, b int) int {55 return a / b56 }57 func Sub(a, b int) int {58 return a - b59 }60 `)61 pkgATestFile = []byte(`package pkga62 import (63 "testing"64 )65 func TestDiv(t *testing.T) {66 if Div(3, 2) != 1 {67 t.Error("Div unexpected result")68 }69 }70 func TestSub(t *testing.T) {71 if Sub(10, 5) != 5 {72 t.Error("Sub unexpected result")73 }74 }`)75 fileAAddDouble = []byte(`package main76 func add(a, b int) int {77 return a + b78 }79 func mul(a, b int) int {80 return a * b81 }82 func double(a int) int {83 return 2 * a84 }85 `)86 mainTestFileAddDouble = []byte(`package main87 import (88 "testing"89 )90 func TestAdd(t *testing.T) {91 if add(3, 4) != 7 {92 t.Error("add unexpected result")93 }94 }95 func TestMul(t *testing.T) {96 if mul(10, 5) != 50 {97 t.Error("mul unexpected result")98 }99 }100 func TestDouble(t *testing.T) {101 if double(1) != 2 {102 t.Error("double unexpected result")103 }104 }105 `)106 fileAChangeMul = []byte(`package main107 func add(a, b int) int {108 return a + b109 }110 func mul(a, b int) int {111 return a * b * 1112 }113 func double(a int) int {114 return 2 * a115 }116 `)117 pkgAfileAChangeSub = []byte(`package pkga118 func Div(a, b int) int {119 return a / b120 }121 func Sub(a, b int) int {122 return a - b + 0123 }`)124 pkgATestFileUpdate = []byte(`package pkga125 import (126 "testing"127 )128 func TestDiv(t *testing.T) {129 if Div(6, 2) != 3 {130 t.Error("Div unexpected result")131 }132 }133 func TestSub(t *testing.T) {134 if Sub(10, 5) != 5 {135 t.Error("Sub unexpected result")136 }137 }`)138 testAddProf = []byte(`mode: set139cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0140cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0141cover-strategy-test-run/file_a.go:3.26,5.4 1 1142cover-strategy-test-run/file_a.go:7.26,9.4 1 0143cover-strategy-test-run/file_a.go:11.26,13.4 1 0144cover-strategy-test-run/main.go:10.15,12.4 1 0145cover-strategy-test-run/main.go:14.26,16.4 1 0146`)147 testDivProf = []byte(`mode: set148cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 1149cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0150cover-strategy-test-run/file_a.go:3.26,5.4 1 0151cover-strategy-test-run/file_a.go:7.26,9.4 1 0152cover-strategy-test-run/file_a.go:11.26,13.4 1 0153cover-strategy-test-run/main.go:10.15,12.4 1 0154cover-strategy-test-run/main.go:14.26,16.4 1 0155`)156 testDoubleProf = []byte(`mode: set157cover-strategy-test-run/file_a.go:3.26,5.4 1 0158cover-strategy-test-run/file_a.go:7.26,9.4 1 0159cover-strategy-test-run/file_a.go:11.26,13.4 1 1160cover-strategy-test-run/main.go:10.15,12.4 1 0161cover-strategy-test-run/main.go:14.26,16.4 1 0162cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0163cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0164`)165 testMulProf = []byte(`mode: set166cover-strategy-test-run/main.go:10.15,12.4 1 0167cover-strategy-test-run/main.go:14.26,16.4 1 0168cover-strategy-test-run/file_a.go:3.26,5.4 1 0169cover-strategy-test-run/file_a.go:7.26,9.4 1 1170cover-strategy-test-run/file_a.go:11.26,13.4 1 0171cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0172cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 0173`)174 testSubProf = []byte(`mode: set175cover-strategy-test-run/pkga/file_a.go:3.26,5.4 1 0176cover-strategy-test-run/pkga/file_a.go:7.26,9.4 1 1177cover-strategy-test-run/file_a.go:3.26,5.4 1 0178cover-strategy-test-run/file_a.go:7.26,9.4 1 0179cover-strategy-test-run/file_a.go:11.26,13.4 1 0180cover-strategy-test-run/main.go:10.15,12.4 1 0181cover-strategy-test-run/main.go:14.26,16.4 1 0182`)183 )184 // setup185 testDir := filepath.Join(os.TempDir(), "test_cover_strategy_tests_to_run")186 gitCmdRun := NewGitCmd(testDir)187 pkgAFileAPath := filepath.Join("pkga", "file_a.go")188 pkgATestFileAPath := filepath.Join("pkga", "file_a_test.go")189 files := map[string][]byte{190 "go.mod": gomod,191 "main.go": mainFile, "file_a.go": fileA, "main_test.go": mainTestFile,192 pkgAFileAPath: pkgAFileA, pkgATestFileAPath: pkgATestFile,193 }194 logger := log.New(os.Stdout, "gtr-cover-strategy-test:", log.Ltime)195 setup := func() *CoverStrategy {196 setupTestGitDir(t,197 testDir, files,198 []string{199 "go.mod", "main.go", "main_test.go", "file_a.go",200 pkgAFileAPath, pkgATestFileAPath,201 },202 )203 // TODO test with different configurations204 return NewCoverStrategy(true, testDir, logger)205 }206 // teardown207 defer func() {208 if !t.Failed() {209 // clean tmp dir on test success210 _ = os.RemoveAll(testDir)211 }212 }()213 cases := []struct {214 desc string215 setup, tearDown func() error216 outTests []string217 err error218 }{219 {220 desc: "No changes in files, no cover profiles",221 outTests: []string{"cover-strategy-test-run.TestAdd",222 "cover-strategy-test-run.TestMul",223 "cover-strategy-test-run/pkga.TestDiv",224 "cover-strategy-test-run/pkga.TestSub"},225 },226 {227 desc: "Add func double in file_a.go",228 setup: func() error {229 return ioutil.WriteFile(230 filepath.Join(testDir, "file_a.go"), fileAAddDouble, 0600)231 },232 tearDown: func() error {233 files := [][]byte{234 []byte("cover-strategy-test-run.TestAdd"),235 testAddProf,236 []byte("cover-strategy-test-run.TestMul"),237 testMulProf,238 []byte("cover-strategy-test-run.TestDouble"),239 testDoubleProf,240 []byte("cover-strategy-test-run_pkga.TestSub"),241 testSubProf,242 []byte("cover-strategy-test-run_pkga.TestDiv"),243 testDivProf,244 }245 for i := 0; i < len(files); i += 2 {246 err := ioutil.WriteFile(247 filepath.Join(testDir, ".gtr", string(files[i])),248 files[i+1], 0600)249 if err != nil {250 return err251 }252 }253 return gitCmdRun("commit", "-am", "changes")254 },255 outTests: nil,256 },257 {258 desc: "Add test to Double",259 setup: func() error {260 return ioutil.WriteFile(261 filepath.Join(testDir, "main_test.go"),262 mainTestFileAddDouble, 0600)263 },264 tearDown: func() error {265 return gitCmdRun("commit", "-am", "commit changes") // Test266 },267 outTests: []string{"cover-strategy-test-run.TestDouble"},268 },269 {270 desc: "Update mul func in file_a.go and sub in pkga/file_a.go",271 setup: func() error {272 err := ioutil.WriteFile(273 filepath.Join(testDir, "file_a.go"),274 fileAChangeMul, 0600)275 if err != nil {276 return err277 }278 return ioutil.WriteFile(279 filepath.Join(testDir, pkgAFileAPath),280 pkgAfileAChangeSub, 0600)281 },282 tearDown: func() error {283 return gitCmdRun("commit", "-am", "commit changes")284 },285 outTests: []string{"cover-strategy-test-run.TestMul",286 "cover-strategy-test-run/pkga.TestSub"},287 },288 {289 desc: "Update in pkga",290 setup: func() error {291 return ioutil.WriteFile(292 filepath.Join(testDir, pkgATestFileAPath),293 pkgATestFileUpdate, 0600)294 },295 tearDown: func() error {296 return gitCmdRun("commit", "-am", "commit changes") // Test297 },298 outTests: []string{"cover-strategy-test-run/pkga.TestDiv"},299 },300 }301 coverStrategy := setup()302 for i, tc := range cases {303 // setup()304 execTestHelper(t, i, tc.desc, tc.setup)305 _, testsList, _, err := coverStrategy.TestsToRun(context.Background())306 // teardown()307 execTestHelper(t, i, tc.desc, tc.tearDown)308 if isUnexpectedErr(t, i, tc.desc, tc.err, err) {309 continue310 }311 // TODO test packages are handled312 sort.Strings(tc.outTests)313 sort.Strings(testsList)314 if !reflect.DeepEqual(tc.outTests, testsList) {315 t.Errorf("case [%d] %s\nexpected Tests %+v\ngot %+v", i, tc.desc, tc.outTests, testsList)316 }317 }318}319func TestFindAllTestInDir(t *testing.T) {320 var (321 moduleName = "find-all.tests"322 gomod = []byte(`module find-all.tests323 go 1.13324 `)325 mainFile = []byte(`package main326 import (327 "fmt"328 "find-all.tests/pkga"329 )330 var a, b int = 10, 20331 func main() {332 fmt.Printf("%+v\n", add(a, b))333 }334 func sub(a, b int) int {335 return pkga.Sub(a, b)336 }337 `)338 fileA = []byte(`package main339 func add(a, b int) int {340 return a + b341 }342 func mul(a, b int) int {343 return a * b344 }345 `)346 mainTestFile = []byte(`package main347 import (348 "testing"349 )350 func TestAdd(t *testing.T) {351 if add(3, 4) != 7 {352 t.Error("add unexpected result")353 }354 }355 func TestMul(t *testing.T) {356 if mul(10, 5) != 50 {357 t.Error("mul unexpected result")358 }359 }360 `)361 pkgAFileA = []byte(`package pkga362 func Div(a, b int) int {363 return a / b364 }365 func Sub(a, b int) int {366 return a - b367 }368 func Test(a, b int) bool {369 return a > b370 }371 `)372 pkgATestFile = []byte(`package pkga373 import (374 "testing"375 )376 func TestDiv(t *testing.T) {377 if Div(3, 2) != 1 {378 t.Error("Div unexpected result")379 }380 }381 func TestSub(t *testing.T) {382 if Sub(10, 5) != 5 {383 t.Error("Sub unexpected result")384 }385 }386 type TT struct {}387 func (t *TT) TestNot(a int) int {388 return a389 }390 `)391 )392 // setup393 testDir := filepath.Join(os.TempDir(), "test_find_all_tests_in_dir")394 pkgAFileAPath := filepath.Join("pkga", "file_a.go")395 pkgATestFileAPath := filepath.Join("pkga", "file_a_test.go")396 files := map[string][]byte{397 "go.mod": gomod,398 "main.go": mainFile, "file_a.go": fileA, "main_test.go": mainTestFile,399 pkgAFileAPath: pkgAFileA, pkgATestFileAPath: pkgATestFile,400 }401 setup := func() {402 setupTestGitDir(t,403 testDir, files,404 []string{405 "go.mod", "main.go", "main_test.go", "file_a.go",406 pkgAFileAPath, pkgATestFileAPath,407 },408 )409 }410 // teardown411 defer func() {412 if !t.Failed() {413 // clean tmp dir on test success414 _ = os.RemoveAll(testDir)415 }416 }()417 cases := []struct {418 desc string419 setup, tearDown func() error420 outTests []string421 err error422 }{423 {424 desc: "Find all test which are runnable by go test",425 outTests: []string{"find-all.tests.TestAdd",426 "find-all.tests.TestMul",427 "find-all.tests/pkga.TestDiv",428 "find-all.tests/pkga.TestSub"},429 },430 }431 setup()432 for i, tc := range cases {433 // setup()434 execTestHelper(t, i, tc.desc, tc.setup)435 tests, err := findAllTestInDir(context.Background(), moduleName, testDir)436 // teardown()437 execTestHelper(t, i, tc.desc, tc.tearDown)438 if isUnexpectedErr(t, i, tc.desc, tc.err, err) {...

Full Screen

Full Screen

example_test.go

Source:example_test.go Github

copy

Full Screen

...14 // Example output:15 // whoops16 // github.com/pkg/errors_test.ExampleNew_printf17 // /home/dfc/src/github.com/pkg/errors/example_test.go:1718 // testing.runExample19 // /home/dfc/go/src/testing/example.go:11420 // testing.RunExamples21 // /home/dfc/go/src/testing/example.go:3822 // testing.(*M).Run23 // /home/dfc/go/src/testing/testing.go:74424 // main.main25 // /github.com/pkg/errors/_test/_testmain.go:10626 // runtime.main27 // /home/dfc/go/src/runtime/proc.go:18328 // runtime.goexit29 // /home/dfc/go/src/runtime/asm_amd64.s:205930}31func ExampleWithMessage() {32 cause := errors.New("whoops")33 err := errors.WithMessage(cause, "oh noes")34 fmt.Println(err)35 // Output: oh noes: whoops36}37func ExampleWithStack() {38 cause := errors.New("whoops")39 err := errors.WithStack(cause)40 fmt.Println(err)41 // Output: whoops42}43func ExampleWithStack_printf() {44 cause := errors.New("whoops")45 err := errors.WithStack(cause)46 fmt.Printf("%+v", err)47 // Example Output:48 // whoops49 // github.com/pkg/errors_test.ExampleWithStack_printf50 // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:5551 // testing.runExample52 // /usr/lib/go/src/testing/example.go:11453 // testing.RunExamples54 // /usr/lib/go/src/testing/example.go:3855 // testing.(*M).Run56 // /usr/lib/go/src/testing/testing.go:74457 // main.main58 // github.com/pkg/errors/_test/_testmain.go:10659 // runtime.main60 // /usr/lib/go/src/runtime/proc.go:18361 // runtime.goexit62 // /usr/lib/go/src/runtime/asm_amd64.s:208663 // github.com/pkg/errors_test.ExampleWithStack_printf64 // /home/fabstu/go/src/github.com/pkg/errors/example_test.go:5665 // testing.runExample66 // /usr/lib/go/src/testing/example.go:11467 // testing.RunExamples68 // /usr/lib/go/src/testing/example.go:3869 // testing.(*M).Run70 // /usr/lib/go/src/testing/testing.go:74471 // main.main72 // github.com/pkg/errors/_test/_testmain.go:10673 // runtime.main74 // /usr/lib/go/src/runtime/proc.go:18375 // runtime.goexit76 // /usr/lib/go/src/runtime/asm_amd64.s:208677}78func ExampleWrap() {79 cause := errors.New("whoops")80 err := errors.Wrap(cause, "oh noes")81 fmt.Println(err)82 // Output: oh noes: whoops83}84func fn() error {85 e1 := errors.New("error")86 e2 := errors.Wrap(e1, "inner")87 e3 := errors.Wrap(e2, "middle")88 return errors.Wrap(e3, "outer")89}90func ExampleCause() {91 err := fn()92 fmt.Println(err)93 fmt.Println(errors.Cause(err))94 // Output: outer: middle: inner: error95 // error96}97func ExampleWrap_extended() {98 err := fn()99 fmt.Printf("%+v\n", err)100 // Example output:101 // error102 // github.com/pkg/errors_test.fn103 // /home/dfc/src/github.com/pkg/errors/example_test.go:47104 // github.com/pkg/errors_test.ExampleCause_printf105 // /home/dfc/src/github.com/pkg/errors/example_test.go:63106 // testing.runExample107 // /home/dfc/go/src/testing/example.go:114108 // testing.RunExamples109 // /home/dfc/go/src/testing/example.go:38110 // testing.(*M).Run111 // /home/dfc/go/src/testing/testing.go:744112 // main.main113 // /github.com/pkg/errors/_test/_testmain.go:104114 // runtime.main115 // /home/dfc/go/src/runtime/proc.go:183116 // runtime.goexit117 // /home/dfc/go/src/runtime/asm_amd64.s:2059118 // github.com/pkg/errors_test.fn119 // /home/dfc/src/github.com/pkg/errors/example_test.go:48: inner120 // github.com/pkg/errors_test.fn121 // /home/dfc/src/github.com/pkg/errors/example_test.go:49: middle122 // github.com/pkg/errors_test.fn123 // /home/dfc/src/github.com/pkg/errors/example_test.go:50: outer124}125func ExampleWrapf() {126 cause := errors.New("whoops")127 err := errors.Wrapf(cause, "oh noes #%d", 2)128 fmt.Println(err)129 // Output: oh noes #2: whoops130}131func ExampleErrorf_extended() {132 err := errors.Errorf("whoops: %s", "foo")133 fmt.Printf("%+v", err)134 // Example output:135 // whoops: foo136 // github.com/pkg/errors_test.ExampleErrorf137 // /home/dfc/src/github.com/pkg/errors/example_test.go:101138 // testing.runExample139 // /home/dfc/go/src/testing/example.go:114140 // testing.RunExamples141 // /home/dfc/go/src/testing/example.go:38142 // testing.(*M).Run143 // /home/dfc/go/src/testing/testing.go:744144 // main.main145 // /github.com/pkg/errors/_test/_testmain.go:102146 // runtime.main147 // /home/dfc/go/src/runtime/proc.go:183148 // runtime.goexit149 // /home/dfc/go/src/runtime/asm_amd64.s:2059150}151func Example_stackTrace() {152 type stackTracer interface {153 StackTrace() errors.StackTrace154 }155 err, ok := errors.Cause(fn()).(stackTracer)156 if !ok {157 panic("oops, err does not implement stackTracer")158 }159 st := err.StackTrace()160 fmt.Printf("%+v", st[0:2]) // top two frames161 // Example output:162 // github.com/pkg/errors_test.fn163 // /home/dfc/src/github.com/pkg/errors/example_test.go:47...

Full Screen

Full Screen

main.go

Source:main.go Github

copy

Full Screen

...35//36// -----------------------------------------37// Your solution should not accept invalid months38// -----------------------------------------39// go run main.go40// Give me a month name41//42// go run main.go sheep43// "sheep" is not a month.44//45// -----------------------------------------46// Your solution should handle the leap years47// -----------------------------------------48// go run main.go january49// "january" has 31 days.50//51// go run main.go february52// "february" has 28 days.53//54// go run main.go march55// "march" has 31 days.56//57// go run main.go april58// "april" has 30 days.59//60// go run main.go may61// "may" has 31 days.62//63// go run main.go june64// "june" has 30 days.65//66// go run main.go july67// "july" has 31 days.68//69// go run main.go august70// "august" has 31 days.71//72// go run main.go september73// "september" has 30 days.74//75// go run main.go october76// "october" has 31 days.77//78// go run main.go november79// "november" has 30 days.80//81// go run main.go december82// "december" has 31 days.83//84// -----------------------------------------85// Your solution should be case insensitive86// -----------------------------------------87// go run main.go DECEMBER88// "DECEMBER" has 31 days.89//90// go run main.go dEcEmBeR91// "dEcEmBeR" has 31 days.92// ---------------------------------------------------------93func main() {94 a := os.Args95 l := len(a)96 y := time.Now().Year()97 if l < 2 {98 fmt.Println("Give me a month name.")99 }100 numberDays := 28101 leapYear := y%4 == 0 && (y%100 != 0 || y%400 != 0)102 if m := strings.ToLower(a[1]); m == "april" ||103 m == "june" ||104 m == "september" ||...

Full Screen

Full Screen

run.go

Source:run.go Github

copy

Full Screen

...8// limitations of OpenGL and operating systems. In short, all graphics and window manipulating calls9// must be done from the main thread. Run makes this possible.10//11// Call this function from the main function of your application. This is necessary, so that Run12// runs on the main thread.13//14// func run() {15// // interact with Pixel and PixelGL from here (even concurrently)16// }17//18// func main() {19// pixel.Run(run)20// }21//22// You can spawn any number of goroutines from your run function and interact with PixelGL23// concurrently. The only condition is that the Run function is called from your main function.24func Run(run func()) {25 err := glfw.Init()26 if err != nil {27 panic(errors.Wrap(err, "failed to initialize GLFW"))28 }29 defer glfw.Terminate()30 mainthread.Run(run)31}...

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 switch os.Args[1] {4 run()5 child()6 panic("what??")7 }8}9func run() {10 fmt.Printf("Running %v as %d11", os.Args[2:], os.Getpid())12 cmd := exec.Command("/proc/self/exe", append([]string{"child"}, os.Args[2:]...)...)13 cmd.SysProcAttr = &syscall.SysProcAttr{14 }15 must(cmd.Run())16}17func child() {18 fmt.Printf("Running %v as %d19", os.Args[2:], os.Getpid())20 cmd := exec.Command(os.Args[2], os.Args[3:]...)21 must(syscall.Chroot("/home/rajesh/containers/centos"))22 must(os.Chdir("/"))23 must(syscall.Mount("proc", "proc", "proc", 0, ""))24 must(cmd.Run())25 must(syscall.Unmount("proc", 0))26}27func must(err error) {28 if err != nil {29 panic(err)30 }31}

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World")4}5import (6func main() {7 fmt.Println("Hello World")8}9import (10func main() {11 fmt.Println("Hello World")12}13import (14func main() {15 fmt.Println("Hello World")16}17import (18func main() {19 fmt.Println("Hello World")20}21import (22func main() {23 fmt.Println("Hello World")24}25import (26func main() {27 fmt.Println("Hello World")28}29import (30func main() {31 fmt.Println("Hello World")32}33import (34func main() {35 fmt.Println("Hello World")36}37import (38func main() {39 fmt.Println("Hello World")40}41import (42func main() {43 fmt.Println("Hello World")44}45import (46func main() {47 fmt.Println("Hello World")48}49import (50func main() {51 fmt.Println("Hello World")52}53import (54func main() {55 fmt.Println("Hello

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, playground")4}5import (6func main() {7 fmt.Println("Hello, playground")8}9import (10func main() {11 fmt.Println("Hello, playground")12}13import (14func main() {15 fmt.Println("Hello, playground")16}17import (18func main() {19 fmt.Println("Hello, playground")20}21import (22func main() {23 fmt.Println("Hello, playground")24}25import (26func main() {27 fmt.Println("Hello, playground")28}29import (30func main() {31 fmt.Println("Hello, playground")32}33import (34func main() {35 fmt.Println("Hello, playground")36}37import (38func main() {39 fmt.Println("Hello, playground")40}41import (42func main() {43 fmt.Println("Hello, playground")44}45import (46func main() {47 fmt.Println("Hello, playground")48}49import (50func main() {51 fmt.Println("

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, World!")4}5import (6func main() {7 fmt.Println("Hello, World!")8}9import (10func main() {11 fmt.Println("Hello, World!")12}13import (14func main() {15 fmt.Println("Hello, World!")16}17import (18func main() {19 fmt.Println("Hello, World!")20}21import (22func main() {23 fmt.Println("Hello, World!")24}25import (26func main() {27 fmt.Println("Hello, World!")28}29import (30func main() {31 fmt.Println("Hello, World!")32}33import (34func main() {35 fmt.Println("Hello, World!")36}37import (38func main() {39 fmt.Println("Hello, World!")40}41import (42func main() {43 fmt.Println("Hello, World!")44}45import (46func main() {47 fmt.Println("Hello, World!")48}49import (50func main() {51 fmt.Println("

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println("Hello, World!")4}5import "fmt"6func main() {7 fmt.Println("Hello, World!")8}9import "fmt"10func main() {11 fmt.Println("Hello, World!")12}13import "fmt"14func main() {15 fmt.Println("Hello, World!")16}17import "fmt"18func main() {19 fmt.Println("Hello, World!")20}21import "fmt"22func main() {23 fmt.Println("Hello, World!")24}25import "fmt"26func main() {27 fmt.Println("Hello, World!")28}29import "fmt"30func main() {31 fmt.Println("Hello, World!")32}33import "fmt"34func main() {35 fmt.Println("Hello, World!")36}37import "fmt"38func main() {39 fmt.Println("Hello, World!")40}41import "fmt"42func main() {43 fmt.Println("Hello, World!")44}45import "fmt"46func main() {47 fmt.Println("Hello, World!")48}49import "fmt"50func main() {51 fmt.Println("Hello, World!")52}53import "fmt"54func main() {55 fmt.Println("Hello,

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello World!")4 fmt.Println(runtime.GOOS)5 fmt.Println(runtime.GOARCH)6}7import (8func main() {9 fmt.Println("Hello World!")10 fmt.Println(runtime.GOOS)11 fmt.Println(runtime.GOARCH)12}13import (14func main() {15 fmt.Println("Hello World!")16 fmt.Println(runtime.GOOS)17 fmt.Println(runtime.GOARCH)18}19import (20func main() {21 fmt.Println("Hello World!")22 fmt.Println(runtime.GOOS)23 fmt.Println(runtime.GOARCH)24}25import (26func main() {27 fmt.Println("Hello World!")28 fmt.Println(runtime.GOOS)29 fmt.Println(runtime.GOARCH)30}31import (32func main() {33 fmt.Println("Hello World!")34 fmt.Println(runtime.GOOS)35 fmt.Println(runtime.GOARCH)36}37import (38func main() {39 fmt.Println("Hello World!")40 fmt.Println(runtime.GOOS)41 fmt.Println(runtime.GOARCH)42}43import (44func main() {45 fmt.Println("Hello World!")46 fmt.Println(runtime.GOOS)47 fmt.Println(runtime.GOARCH)48}49import (50func main() {51 fmt.Println("Hello World!")52 fmt.Println(runtime.GOOS)53 fmt.Println(runtime.GOARCH)54}55import (56func main() {57 fmt.Println("Hello

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("hello world")4 time.Sleep(100 * time.Millisecond)5}6import (7func main() {8 fmt.Println("hello world")9 time.Sleep(100 * time.Millisecond)10}11import (12func main() {13 fmt.Println("hello world")14 time.Sleep(100 * time.Millisecond)15}

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 go printNumbers()4 go printAlphabets()5 time.Sleep(3000 * time.Millisecond)6 fmt.Println("main terminated")7}8func printNumbers() {9 for i := 1; i <= 5; i++ {10 fmt.Printf("%d ", i)11 }12 fmt.Println()13}14func printAlphabets() {15 for i := 'A'; i <= 'E'; i++ {16 fmt.Printf("%c ", i)17 }18 fmt.Println()19}20import (21func main() {22 go printNumbers()23 go printAlphabets()24 time.Sleep(3000 * time.Millisecond)25 fmt.Println("main terminated")26}27func printNumbers() {28 for i := 1; i <= 5; i++ {29 fmt.Printf("%d ", i)30 time.Sleep(500 * time.Millisecond)31 }32 fmt.Println()33}34func printAlphabets() {35 for i := 'A'; i <= 'E'; i++ {36 fmt.Printf("%c ", i)37 time.Sleep(500 * time.Millisecond)38 }39 fmt.Println()40}41import (42func main() {43 go printNumbers()44 go printAlphabets()

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1import "fmt"2func main() {3 fmt.Println("Hello, World!")4}5import "fmt"6func main() {7 fmt.Println("Hello, World!")8}9import "fmt"10func main() {11 fmt.Println(a)12}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful