Skip to content

Replace abstract example tests with realistic greeting service scenario - #24

Merged
corbym merged 1 commit into
masterfrom
copilot/update-example-tests-in-readme
Apr 2, 2026
Merged

Replace abstract example tests with realistic greeting service scenario#24
corbym merged 1 commit into
masterfrom
copilot/update-example-tests-in-readme

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

The example tests used meaningless placeholder names (theSystemSetup, somethingHappens, foofar/faff) that failed to demonstrate real BDD usage. This replaces them with a cohesive greeting service domain across all examples.

example_test.go

  • All test functions renamed to TestGreetingService_* with descriptive suffixes
  • Helper functions replaced: aRegisteredUserNamed, aGreetingIsRequested, withLocale, localeIsNotEnglish
  • Skip example now uses a realistic condition (unsupported locale) instead of "fff"
  • fmt and strings stdlib packages used naturally in implementation
func TestGreetingService_PersonalisesGreeting(t *testing.T) {
    gogiven.Given(t, aRegisteredUserNamed("Alice")).
        When(aGreetingIsRequested).
        Then(func(t base.TestingT, captured testdata.CapturedIO, givens testdata.InterestingGivens) {
            // the greeting should address the user by their registered name
            AssertThat(t, captured["greeting"], is.EqualTo("Hello, Alice!"))
        })
}

README.md

  • All three code examples updated to match new function names
  • New Example Four — Without a Given section added with anchor and code block
  • Table of contents and HTML output anchor links updated

base/parsegiven_test.go

  • All parser tests updated to reference new function names and correct expected output strings

@corbym
corbym marked this pull request as ready for review April 2, 2026 18:31
@corbym
corbym merged commit aa32b99 into master Apr 2, 2026
5 checks passed
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.793%. remained the same
when pulling d26af1b on copilot/update-example-tests-in-readme
into 9389ea5 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants