/usr/share/gocode/src/github.com/smartystreets/goconvey/web/server/parser/package_parser_go1.1_test.go is in golang-github-smartystreets-goconvey-dev 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | // +build go1.1,!go1.2
package parser
import (
"encoding/json"
"fmt"
"strings"
"testing"
"github.com/smartystreets/goconvey/reporting"
"github.com/smartystreets/goconvey/web/server/contract"
)
func TestParsePackage_NoGoFiles_ReturnsPackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expected_NoGoFiles.PackageName}
ParsePackageResults(actual, input_NoGoFiles)
assertEqual(t, expected_NoGoFiles, *actual)
}
func TestParsePackage_NoTestFiles_ReturnsPackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expected_NoTestFiles.PackageName}
ParsePackageResults(actual, input_NoTestFiles)
assertEqual(t, expected_NoTestFiles, *actual)
}
func TestParsePacakge_NoTestFunctions_ReturnsPackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expected_NoTestFunctions.PackageName}
ParsePackageResults(actual, input_NoTestFunctions)
assertEqual(t, expected_NoTestFunctions, *actual)
}
func TestParsePackage_BuildFailed_ReturnsPackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expected_BuildFailed_InvalidPackageDeclaration.PackageName}
ParsePackageResults(actual, input_BuildFailed_InvalidPackageDeclaration)
assertEqual(t, expected_BuildFailed_InvalidPackageDeclaration, *actual)
actual = &contract.PackageResult{PackageName: expected_BuildFailed_OtherErrors.PackageName}
ParsePackageResults(actual, input_BuildFailed_OtherErrors)
assertEqual(t, expected_BuildFailed_OtherErrors, *actual)
actual = &contract.PackageResult{PackageName: expected_BuildFailed_CantFindPackage.PackageName}
ParsePackageResults(actual, input_BuildFailed_CantFindPackage)
assertEqual(t, expected_BuildFailed_CantFindPackage, *actual)
}
func TestParsePackage_OldSchoolWithFailureOutput_ReturnsCompletePackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedOldSchool_Fails.PackageName}
ParsePackageResults(actual, inputOldSchool_Fails)
assertEqual(t, expectedOldSchool_Fails, *actual)
}
func TestParsePackage_OldSchoolWithSuccessOutput_ReturnsCompletePackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedOldSchool_Passes.PackageName}
ParsePackageResults(actual, inputOldSchool_Passes)
assertEqual(t, expectedOldSchool_Passes, *actual)
}
func TestParsePackage_OldSchoolWithPanicOutput_ReturnsCompletePackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedOldSchool_Panics.PackageName}
ParsePackageResults(actual, inputOldSchool_Panics)
assertEqual(t, expectedOldSchool_Panics, *actual)
}
func TestParsePackage_GoConveyOutput_ReturnsCompletePackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedGoConvey.PackageName}
ParsePackageResults(actual, inputGoConvey)
assertEqual(t, expectedGoConvey, *actual)
}
func TestParsePackage_ActualPackageNameDifferentThanDirectoryName_ReturnsActualPackageName(t *testing.T) {
actual := &contract.PackageResult{PackageName: strings.Replace(expectedGoConvey.PackageName, "examples", "stuff", -1)}
ParsePackageResults(actual, inputGoConvey)
assertEqual(t, expectedGoConvey, *actual)
}
func TestParsePackage_GoConveyOutputMalformed_CausesPanic(t *testing.T) {
defer func() {
if r := recover(); r != nil {
message := fmt.Sprintf("%v", r)
if !strings.Contains(message, "bug report") {
t.Errorf("Should have panicked with a request to file a bug report but we received this error instead: %s", message)
}
} else {
t.Errorf("Should have panicked with a request to file a bug report but we received no error.")
}
}()
actual := &contract.PackageResult{PackageName: expectedGoConvey.PackageName}
ParsePackageResults(actual, inputGoConvey_Malformed)
}
func TestParsePackage_GoConveyWithRandomOutput_ReturnsPackageResult(t *testing.T) {
actual := &contract.PackageResult{PackageName: expectedGoConvey_WithRandomOutput.PackageName}
ParsePackageResults(actual, inputGoConvey_WithRandomOutput)
assertEqual(t, expectedGoConvey_WithRandomOutput, *actual)
}
func assertEqual(t *testing.T, expected, actual interface{}) {
a, _ := json.Marshal(expected)
b, _ := json.Marshal(actual)
if string(a) != string(b) {
t.Errorf(failureTemplate, string(a), string(b))
}
}
const failureTemplate = "Comparison failed:\n Expected: %v\n Actual: %v\n"
const input_NoGoFiles = `can't load package: package github.com/smartystreets/goconvey: no Go source files in /Users/matt/Work/Dev/goconvey/src/github.com/smartystreets/goconvey`
var expected_NoGoFiles = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey",
Outcome: contract.NoGoFiles,
BuildOutput: input_NoGoFiles,
}
const input_NoTestFiles = `? pkg.smartystreets.net/liveaddress-zipapi [no test files]`
var expected_NoTestFiles = contract.PackageResult{
PackageName: "pkg.smartystreets.net/liveaddress-zipapi",
Outcome: contract.NoTestFiles,
BuildOutput: input_NoTestFiles,
}
const input_NoTestFunctions = `testing: warning: no tests to run`
var expected_NoTestFunctions = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Outcome: contract.NoTestFunctions,
BuildOutput: input_NoTestFunctions,
}
const input_BuildFailed_InvalidPackageDeclaration = `
can't load package: package github.com/smartystreets/goconvey/examples:
bowling_game_test.go:9:1: expected 'package', found 'IDENT' asdf
bowling_game_test.go:10:1: invalid package name _
`
var expected_BuildFailed_InvalidPackageDeclaration = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/examples",
Outcome: contract.BuildFailure,
BuildOutput: strings.TrimSpace(input_BuildFailed_InvalidPackageDeclaration),
}
const input_BuildFailed_CantFindPackage = `
bowling_game.go:3:8: cannot find package "format" in any of:
/usr/local/go/src/pkg/format (from $GOROOT)
/Users/mike/work/dev/goconvey/src/format (from $GOPATH)
`
var expected_BuildFailed_CantFindPackage = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/examples",
Outcome: contract.BuildFailure,
BuildOutput: strings.TrimSpace(input_BuildFailed_CantFindPackage),
}
const input_BuildFailed_OtherErrors = `
# github.com/smartystreets/goconvey/examples
./bowling_game_test.go:22: undefined: game
./bowling_game_test.go:22: cannot assign to game
./bowling_game_test.go:25: undefined: game
./bowling_game_test.go:28: undefined: game
./bowling_game_test.go:33: undefined: game
./bowling_game_test.go:36: undefined: game
./bowling_game_test.go:41: undefined: game
./bowling_game_test.go:42: undefined: game
./bowling_game_test.go:43: undefined: game
./bowling_game_test.go:46: undefined: game
./bowling_game_test.go:46: too many errors
FAIL github.com/smartystreets/goconvey/examples [build failed]
`
var expected_BuildFailed_OtherErrors = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/examples",
Outcome: contract.BuildFailure,
BuildOutput: strings.TrimSpace(input_BuildFailed_OtherErrors),
}
const inputOldSchool_Passes = `
=== RUN TestOldSchool_Passes
--- PASS: TestOldSchool_Passes (0.02 seconds)
=== RUN TestSkippingTests
--- SKIP: TestSkipping (0.00 seconds)
old_school_test.go:8: blah
=== RUN TestOldSchool_PassesWithMessage
--- PASS: TestOldSchool_PassesWithMessage (0.05 seconds)
old_school_test.go:10: I am a passing test.
With a newline.
PASS
ok github.com/smartystreets/goconvey/webserver/examples 0.018s
`
var expectedOldSchool_Passes = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Elapsed: 0.018,
Outcome: contract.Passed,
TestResults: []contract.TestResult{
contract.TestResult{
TestName: "TestOldSchool_Passes",
Elapsed: 0.02,
Passed: true,
File: "",
Line: 0,
Message: "",
Stories: []reporting.ScopeResult{},
},
contract.TestResult{
TestName: "TestSkippingTests",
Elapsed: 0,
Passed: true,
Skipped: true,
File: "old_school_test.go",
Line: 8,
Message: "old_school_test.go:8: blah",
Stories: []reporting.ScopeResult{},
},
contract.TestResult{
TestName: "TestOldSchool_PassesWithMessage",
Elapsed: 0.05,
Passed: true,
File: "old_school_test.go",
Line: 10,
Message: "old_school_test.go:10: I am a passing test.\nWith a newline.",
Stories: []reporting.ScopeResult{},
},
},
}
const inputOldSchool_Fails = `
=== RUN TestOldSchool_Passes
--- PASS: TestOldSchool_Passes (0.01 seconds)
=== RUN TestOldSchool_PassesWithMessage
--- PASS: TestOldSchool_PassesWithMessage (0.03 seconds)
old_school_test.go:10: I am a passing test.
With a newline.
=== RUN TestOldSchool_Failure
--- FAIL: TestOldSchool_Failure (0.06 seconds)
=== RUN TestOldSchool_FailureWithReason
--- FAIL: TestOldSchool_FailureWithReason (0.11 seconds)
old_school_test.go:18: I am a failing test.
FAIL
exit status 1
FAIL github.com/smartystreets/goconvey/webserver/examples 0.017s
`
var expectedOldSchool_Fails = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Outcome: contract.Failed,
Elapsed: 0.017,
TestResults: []contract.TestResult{
contract.TestResult{
TestName: "TestOldSchool_Passes",
Elapsed: 0.01,
Passed: true,
File: "",
Line: 0,
Message: "",
Stories: []reporting.ScopeResult{},
},
contract.TestResult{
TestName: "TestOldSchool_PassesWithMessage",
Elapsed: 0.03,
Passed: true,
File: "old_school_test.go",
Line: 10,
Message: "old_school_test.go:10: I am a passing test.\nWith a newline.",
Stories: []reporting.ScopeResult{},
},
contract.TestResult{
TestName: "TestOldSchool_Failure",
Elapsed: 0.06,
Passed: false,
File: "",
Line: 0,
Message: "",
Stories: []reporting.ScopeResult{},
},
contract.TestResult{
TestName: "TestOldSchool_FailureWithReason",
Elapsed: 0.11,
Passed: false,
File: "old_school_test.go",
Line: 18,
Message: "old_school_test.go:18: I am a failing test.",
Stories: []reporting.ScopeResult{},
},
},
}
const inputOldSchool_Panics = `
=== RUN TestOldSchool_Panics
--- FAIL: TestOldSchool_Panics (0.02 seconds)
panic: runtime error: index out of range [recovered]
panic: runtime error: index out of range
goroutine 3 [running]:
testing.func·004()
/usr/local/go/src/pkg/testing/testing.go:348 +0xcd
github.com/smartystreets/goconvey/webserver/examples.TestOldSchool_Panics(0x210292000)
/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go:15 +0xec
testing.tRunner(0x210292000, 0x1b09f0)
/usr/local/go/src/pkg/testing/testing.go:353 +0x8a
created by testing.RunTests
/usr/local/go/src/pkg/testing/testing.go:433 +0x86b
goroutine 1 [chan receive]:
testing.RunTests(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1, ...)
/usr/local/go/src/pkg/testing/testing.go:434 +0x88e
testing.Main(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1b7f60, ...)
/usr/local/go/src/pkg/testing/testing.go:365 +0x8a
main.main()
github.com/smartystreets/goconvey/webserver/examples/_test/_testmain.go:43 +0x9a
exit status 2
FAIL github.com/smartystreets/goconvey/webserver/examples 0.014s
`
var expectedOldSchool_Panics = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Elapsed: 0.014,
Outcome: contract.Panicked,
TestResults: []contract.TestResult{
contract.TestResult{
TestName: "TestOldSchool_Panics",
Elapsed: 0.02,
Passed: false,
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go",
Line: 15,
Message: "",
Error: strings.Replace(`panic: runtime error: index out of range [recovered]
panic: runtime error: index out of range
goroutine 3 [running]:
testing.func·004()
/usr/local/go/src/pkg/testing/testing.go:348 +0xcd
github.com/smartystreets/goconvey/webserver/examples.TestOldSchool_Panics(0x210292000)
/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/something_test.go:15 +0xec
testing.tRunner(0x210292000, 0x1b09f0)
/usr/local/go/src/pkg/testing/testing.go:353 +0x8a
created by testing.RunTests
/usr/local/go/src/pkg/testing/testing.go:433 +0x86b
goroutine 1 [chan receive]:
testing.RunTests(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1, ...)
/usr/local/go/src/pkg/testing/testing.go:434 +0x88e
testing.Main(0x138f38, 0x1b09f0, 0x1, 0x1, 0x1b7f60, ...)
/usr/local/go/src/pkg/testing/testing.go:365 +0x8a
main.main()
github.com/smartystreets/goconvey/webserver/examples/_test/_testmain.go:43 +0x9a`, "\u0009", "\t", -1),
Stories: []reporting.ScopeResult{},
},
},
}
const inputGoConvey_Malformed = `
=== RUN TestPassingStory
>>>>>
{
"Title": "A passing story",
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
"Line": 11,
"Depth": 0,
"Assertions": [
{
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
"Line": 10,
"Failure": "",
;aiwheopinen39 n3902n92m
"Error": null,
"Skipped": false,
"StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
}
]
},
<<<<<
--- PASS: TestPassingStory (0.01 seconds)
PASS
ok github.com/smartystreets/goconvey/webserver/examples 0.019s
`
const inputGoConvey = `
=== RUN TestPassingStory
>>>>>
{
"Title": "A passing story",
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
"Line": 11,
"Depth": 0,
"Assertions": [
{
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
"Line": 10,
"Failure": "",
"Error": null,
"Skipped": false,
"StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
}
]
},
<<<<<
--- PASS: TestPassingStory (0.01 seconds)
PASS
ok github.com/smartystreets/goconvey/webserver/examples 0.019s
`
var expectedGoConvey = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/webserver/examples",
Elapsed: 0.019,
Outcome: contract.Passed,
TestResults: []contract.TestResult{
contract.TestResult{
TestName: "TestPassingStory",
Elapsed: 0.01,
Passed: true,
File: "",
Line: 0,
Message: "",
Stories: []reporting.ScopeResult{
reporting.ScopeResult{
Title: "A passing story",
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
Line: 11,
Depth: 0,
Assertions: []*reporting.AssertionResult{
&reporting.AssertionResult{
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go",
Line: 10,
Failure: "",
Error: nil,
Skipped: false,
StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/webserver/examples.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:10 +0xe3\ngithub.com/smartystreets/goconvey/webserver/examples.TestPassingStory(0x210314000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/webserver/examples/old_school_test.go:11 +0xec\ntesting.tRunner(0x210314000, 0x21ab10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
},
},
},
},
},
},
}
const inputGoConvey_WithRandomOutput = `
=== RUN TestPassingStory
*** Hello, World! (1) ***
*** Hello, World! (2) ***
*** Hello, World! (3) ***>>>>>
{
"Title": "A passing story",
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
"Line": 16,
"Depth": 0,
"Assertions": [
{
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
"Line": 14,
"Failure": "",
"Error": null,
"Skipped": false,
"StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:14 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:16 +0x1b9\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
}
]
},
<<<<<
*** Hello, World! (4)***
*** Hello, World! (5) ***
>>>>>
{
"Title": "A passing story",
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
"Line": 22,
"Depth": 0,
"Assertions": [
{
"File": "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
"Line": 20,
"Failure": "",
"Error": null,
"Skipped": false,
"StackTrace": "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·002()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:20 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:22 +0x294\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n"
}
]
},
<<<<<
*** Hello, World! (6) ***
--- PASS: TestPassingStory (0.03 seconds)
PASS
ok github.com/smartystreets/goconvey/web/server/testing 0.024s
`
var expectedGoConvey_WithRandomOutput = contract.PackageResult{
PackageName: "github.com/smartystreets/goconvey/web/server/testing",
Elapsed: 0.024,
Outcome: contract.Passed,
TestResults: []contract.TestResult{
contract.TestResult{
TestName: "TestPassingStory",
Elapsed: 0.03,
Passed: true,
File: "",
Line: 0,
Message: "*** Hello, World! (1) ***\n*** Hello, World! (2) ***\n*** Hello, World! (3) ***\n*** Hello, World! (4)***\n*** Hello, World! (5) ***\n*** Hello, World! (6) ***",
Stories: []reporting.ScopeResult{
reporting.ScopeResult{
Title: "A passing story",
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
Line: 16,
Depth: 0,
Assertions: []*reporting.AssertionResult{
&reporting.AssertionResult{
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
Line: 14,
Failure: "",
Error: nil,
Skipped: false,
StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·001()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:14 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:16 +0x1b9\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
},
},
},
reporting.ScopeResult{
Title: "A passing story",
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
Line: 22,
Depth: 0,
Assertions: []*reporting.AssertionResult{
&reporting.AssertionResult{
File: "/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go",
Line: 20,
Failure: "",
Error: nil,
Skipped: false,
StackTrace: "goroutine 3 [running]:\ngithub.com/smartystreets/goconvey/web/server/testing.func·002()\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:20 +0x186\ngithub.com/smartystreets/goconvey/web/server/testing.TestPassingStory(0x210315000)\n\u0009/Users/mike/work/dev/goconvey/src/github.com/smartystreets/goconvey/web/server/testing/go_test.go:22 +0x294\ntesting.tRunner(0x210315000, 0x21bb10)\n\u0009/usr/local/go/src/pkg/testing/testing.go:353 +0x8a\ncreated by testing.RunTests\n\u0009/usr/local/go/src/pkg/testing/testing.go:433 +0x86b\n",
},
},
},
},
},
},
}
/*
Test output for these tests was generated from the following test code:
Old School style tests:
package examples
import "testing"
func TestOldSchool_Passes(t *testing.T) {
// passes implicitly
}
func TestOldSchool_PassesWithMessage(t *testing.T) {
t.Log("I am a passing test.\nWith a newline.")
}
func TestOldSchool_Failure(t *testing.T) {
t.Fail() // no message
}
func TestOldSchool_FailureWithReason(t *testing.T) {
t.Error("I am a failing test.")
}
GoConvey style tests:
package examples
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestPassingStory(t *testing.T) {
Convey("A passing story", t, func() {
So("This test passes", ShouldContainSubstring, "pass")
})
}
GoConvey style tests with random output:
package examples
import (
"fmt"
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestPassingStory(t *testing.T) {
fmt.Println("*** Hello, World! (1) ***")
Convey("A passing story", t, func() {
fmt.Println("*** Hello, World! (2) ***")
So("This test passes", ShouldContainSubstring, "pass")
fmt.Println("*** Hello, World! (3) ***")
})
Convey("A passing story", t, func() {
fmt.Println("*** Hello, World! (4)***")
So("This test passes", ShouldContainSubstring, "pass")
fmt.Println("*** Hello, World! (5) ***")
})
fmt.Println("*** Hello, World! (6) ***")
}
*/
|