gitlab.com/evatix-go/core@v1.3.55/coreinterface/errcoreinf/all-should-related.go (about) 1 package errcoreinf 2 3 import ( 4 "reflect" 5 6 "gitlab.com/evatix-go/core/coredata/corejson" 7 "gitlab.com/evatix-go/core/coreinterface" 8 "gitlab.com/evatix-go/core/coreinterface/enuminf" 9 ) 10 11 type ShouldBeMessager interface { 12 Title() string 13 Actual() interface{} 14 Expected() interface{} 15 GenericErrorCompiler 16 17 IsTitleEqual(title string) bool 18 IsEqualInterface(right ShouldBeMessager) bool 19 20 CloneNewInterface() ShouldBeMessager 21 ConcatNewInterface(another ShouldBeMessager) ShouldBeMessager 22 } 23 24 type ShouldBeChainCollectionDefiner interface { 25 GenericErrorCompiler 26 27 ListShouldBeChainCollectionDefiner() []ShouldBeMessager 28 Strings() []string 29 } 30 31 type AnyShouldBer interface { 32 AnyShouldBe( 33 title string, 34 actual, expected interface{}, 35 ) BaseErrorOrCollectionWrapper 36 } 37 38 type checkerShouldBer interface { 39 IsEmptyShouldBeTrue( 40 actual coreinterface.IsEmptyChecker, 41 ) ShouldBeChainer 42 43 IsEmptyShouldBeFalse( 44 actual coreinterface.IsEmptyChecker, 45 ) ShouldBeChainer 46 47 IsEnableAnyShouldBeTrue( 48 actual coreinterface.IsEnableAnyChecker, 49 ) ShouldBeChainer 50 51 IsEnableAllShouldBeTrue( 52 actual coreinterface.IsEnableAllChecker, 53 ) ShouldBeChainer 54 55 IsDisabledShouldBeTrue( 56 actual coreinterface.IsDisabledChecker, 57 ) ShouldBeChainer 58 59 IsDisableAllShouldBeTrue( 60 actual coreinterface.IsDisableAllChecker, 61 ) ShouldBeChainer 62 63 IsDisableAnyShouldBeTrue( 64 actual coreinterface.IsDisableAnyChecker, 65 ) ShouldBeChainer 66 } 67 68 type stringsShouldBer interface { 69 ShouldBe( 70 actual, expected []string, 71 ) ShouldBeChainer 72 73 ShouldBeOptions( 74 compareTyper enuminf.StringCompareTyper, 75 actual, expected []string, 76 ) ShouldBeChainer 77 78 LengthShouldBe( 79 actual []string, 80 lengthExpected int, 81 ) ShouldBeChainer 82 83 ShouldBeEqualDistinctOptions( 84 compareTyper enuminf.StringCompareTyper, 85 actual, expected []string, 86 ) ShouldBeChainer 87 88 ShouldBeEqualRegardlessOrderOptions( 89 compareTyper enuminf.StringCompareTyper, 90 actual, expected []string, 91 ) ShouldBeChainer 92 93 DistinctShouldBeOptions( 94 compareTyper enuminf.CompareMethodsTyper, 95 actual, expected []string, 96 ) ShouldBeChainer 97 } 98 99 type stringShouldBer interface { 100 ShouldBe( 101 actual, expected string, 102 ) ShouldBeChainer 103 104 ShouldBeEmpty( 105 actual string, 106 ) ShouldBeChainer 107 108 ShouldBeWhitespace( 109 actual string, 110 ) ShouldBeChainer 111 112 ShouldStartsWith( 113 startsWith, 114 actual string, 115 ) ShouldBeChainer 116 117 ShouldEndsWith( 118 endsWith, 119 actual string, 120 ) ShouldBeChainer 121 122 ShouldContains( 123 contains string, 124 actual string, 125 ) ShouldBeChainer 126 127 NotStartsWith( 128 startsWith, 129 actual string, 130 ) ShouldBeChainer 131 132 NotEndsWith( 133 endsWith, 134 actual string, 135 ) ShouldBeChainer 136 137 NotContains( 138 contains string, 139 actual string, 140 ) ShouldBeChainer 141 142 ShouldBeOptions( 143 compareTyper enuminf.StringCompareTyper, 144 actual, expected string, 145 ) ShouldBeChainer 146 147 ShouldBeDefined( 148 title string, 149 actual string, 150 ) ShouldBeChainer 151 152 ShouldBeEqualByFunc( 153 title string, 154 actual, expected string, 155 compareFunc func(actual, expected string) (isMatch bool), 156 ) ShouldBeChainer 157 } 158 159 type errorShouldBer interface { 160 BaseErrShouldBeEmpty( 161 title string, 162 actual BaseErrorOrCollectionWrapper, 163 ) ShouldBeChainer 164 165 ShouldBeDefined( 166 title string, 167 actual error, 168 ) ShouldBeChainer 169 170 ShouldBeEmpty( 171 title string, 172 actual error, 173 ) ShouldBeChainer 174 175 ErrorDefined(actual error) ShouldBeChainer 176 ErrorEmpty(actual error) ShouldBeChainer 177 } 178 179 type ShouldBeChainer interface { 180 On(isCollect bool) ShouldBeChainer 181 OnString(actual, expected string) ShouldBeChainer 182 OnNull(anyItem interface{}) ShouldBeChainer 183 OnDefined(anyItem interface{}) ShouldBeChainer 184 185 IsCompleted() bool 186 IsFrozen() bool 187 IsAddPossible() bool 188 189 Title(title string) ShouldBeChainer 190 191 JsonerShouldBe( 192 title string, 193 actual, expected corejson.Jsoner, 194 ) ShouldBeChainer 195 196 JsonerShouldBeDefined( 197 title string, 198 actual corejson.Jsoner, 199 ) ShouldBeChainer 200 201 IntegerShouldBeDefined( 202 title string, 203 actual int, 204 ) ShouldBeChainer 205 206 ShouldBeEmptyString( 207 title string, 208 actual string, 209 ) ShouldBeChainer 210 211 ShouldBeEmptyInteger( 212 title string, 213 actual int, 214 ) ShouldBeChainer 215 216 ShouldBeEmptyByte( 217 title string, 218 actual int, 219 ) ShouldBeChainer 220 221 ShouldBeFalse( 222 title string, 223 actual bool, 224 ) ShouldBeChainer 225 226 ShouldBeTrue( 227 title string, 228 actual bool, 229 ) ShouldBeChainer 230 231 JsonResultShouldBe( 232 title string, 233 actual, expected *corejson.Result, 234 ) ShouldBeChainer 235 236 JsonResultShouldBeDefined( 237 title string, 238 actual *corejson.Result, 239 ) ShouldBeChainer 240 241 JsonResultShouldHaveNoError( 242 title string, 243 actual *corejson.Result, 244 ) ShouldBeChainer 245 246 JsonResultShouldHaveNoIssuesOrEmpty( 247 title string, 248 actual *corejson.Result, 249 ) ShouldBeChainer 250 251 IntegerShouldBeGreater( 252 title string, 253 actual, expected int, 254 ) ShouldBeChainer 255 256 IntegerShouldBeGreaterOrEqual( 257 title string, 258 actual, expected int, 259 ) ShouldBeChainer 260 261 BytesShouldBe( 262 title string, 263 actual, expected []byte, 264 ) ShouldBeChainer 265 266 BytesShouldBeDefined( 267 title string, 268 actual []byte, 269 ) ShouldBeChainer 270 271 TypeShouldBe( 272 title string, 273 actual, expected reflect.Type, 274 ) ShouldBeChainer 275 276 TypeShouldBeAnyOf( 277 title string, 278 actual reflect.Type, 279 expectedTypes ...reflect.Type, 280 ) ShouldBeChainer 281 282 ShouldBeSuccess( 283 title string, 284 actual coreinterface.IsSuccessValidator, 285 ) ShouldBeChainer 286 287 ShouldBeFailed( 288 title string, 289 actual coreinterface.IsSuccessValidator, 290 ) ShouldBeChainer 291 292 ShouldBeValid( 293 title string, 294 actual coreinterface.IsSuccessValidator, 295 ) ShouldBeChainer 296 297 PointerShouldBe( 298 title string, 299 actual, expected interface{}, 300 ) ShouldBeChainer 301 302 IntegerShouldBe( 303 title string, 304 actual, expected int, 305 ) ShouldBeChainer 306 307 IntegerShouldBeLessThan( 308 title string, 309 actual, expected int, 310 ) ShouldBeChainer 311 312 IntegerShouldBeCompare( 313 numberCompareTyper enuminf.CompareMethodsTyper, 314 title string, 315 actual, expected int, 316 ) ShouldBeChainer 317 318 ByteShouldBe( 319 title string, 320 actual, expected byte, 321 ) ShouldBeChainer 322 323 ChainerShouldBeEmpty( 324 title string, 325 actual ShouldBeChainer, 326 ) ShouldBeChainer 327 328 LengthShouldBe( 329 title string, 330 actual coreinterface.LengthGetter, 331 expected int, 332 ) ShouldBeChainer 333 334 ShouldBeHaveItem( 335 title string, 336 actual coreinterface.LengthGetter, 337 ) ShouldBeChainer 338 339 SimpleEnumShouldBe( 340 title string, 341 actual, expected enuminf.SimpleEnumer, 342 ) ShouldBeChainer 343 344 BasicEnumShouldBe( 345 title string, 346 actual, expected enuminf.BasicEnumer, 347 ) ShouldBeChainer 348 349 BasicEnumShouldBeInvalid( 350 title string, 351 actual enuminf.BasicEnumer, 352 ) ShouldBeChainer 353 354 BasicEnumShouldBeDefined( 355 title string, 356 actual enuminf.BasicEnumer, 357 ) ShouldBeChainer 358 359 BooleanShouldBe( 360 title string, 361 actual, expected bool, 362 ) ShouldBeChainer 363 364 MapStringAnyShouldBe( 365 title string, 366 actual, expected map[string]interface{}, 367 ) ShouldBeChainer 368 369 Error() errorShouldBer 370 371 ShouldBe( 372 title string, 373 actual, expected interface{}, 374 ) ShouldBeChainer 375 376 ShouldBeOn( 377 isCollect bool, 378 title string, 379 actual, expected interface{}, 380 ) ShouldBeChainer 381 382 ShouldBeRegardlessOn( 383 isCollect bool, 384 title string, 385 actual, expected interface{}, 386 ) ShouldBeChainer 387 388 ShouldBeOption( 389 isRegardless bool, 390 title string, 391 actual, expected interface{}, 392 ) ShouldBeChainer 393 394 ShouldBeOptionOn( 395 isCollect bool, 396 isRegardless bool, 397 title string, 398 actual, expected interface{}, 399 ) ShouldBeChainer 400 401 ShouldBeRegardless( 402 title string, 403 actual, expected interface{}, 404 ) ShouldBeChainer 405 406 ShouldBeUsingFunc( 407 title string, 408 actual, expected interface{}, 409 compareFunc func(actual, expected interface{}) (isMatch bool), 410 ) ShouldBeChainer 411 412 ShouldBeHaveNoPanicFunc( 413 title string, 414 actual, expected interface{}, 415 recoverPanicCompareFunc func(actual, expected interface{}) (isMatch bool), 416 ) ShouldBeChainer 417 418 ShouldBeDefined( 419 title string, 420 actual interface{}, 421 ) ShouldBeChainer 422 423 ManyShouldBeDefined( 424 title string, 425 actualItems ...interface{}, 426 ) ShouldBeChainer 427 428 ShouldBeNull( 429 title string, 430 actual interface{}, 431 ) ShouldBeChainer 432 433 PointerShouldBeNull( 434 title string, 435 actual interface{}, 436 ) ShouldBeChainer 437 438 Equal(actual, expected interface{}) ShouldBeChainer 439 EqualFunc( 440 actual, expected interface{}, 441 compareFunc func(actual, expected interface{}) (isMatch bool), 442 ) ShouldBeChainer 443 EqualOption(isRegardless bool, actual, expected interface{}) ShouldBeChainer 444 EqualRegardless(actual, expected interface{}) ShouldBeChainer 445 446 Checker(title string) checkerShouldBer 447 Str(title string) stringShouldBer 448 Strs(title string) stringsShouldBer 449 450 Compile() BaseErrorOrCollectionWrapper 451 CompileErr() error 452 MustBeEmptier 453 GenericErrorCompiler 454 455 HandleError() 456 CompileString() string 457 CompileJson() string 458 IsCollected() bool 459 460 Append(anotherItems ...ShouldBeChainer) ShouldBeChainer 461 AppendNew(anotherItems ...ShouldBeChainer) ShouldBeChainer 462 463 LogOnIssues() (logged string) 464 465 Strings() []string 466 }