diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000..432b4c9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,59 @@ +name: 🐞 Bug Report +description: File a bug/issue +title: "" +labels: + - bug + +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + + - type: textarea + attributes: + label: Current Behavior + description: A concise description of what you're experiencing. + validations: + required: false + + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false + + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run '...' + 4. See error... + validations: + required: false + + - type: textarea + attributes: + label: Environment + description: | + Please describe your execution environment providing as much detail as possible + render: Markdown + validations: + required: false + + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Anything that will give us more context about the issue you are encountering! + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000..eddf02f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,42 @@ +name: 🚀 Feature Request +description: Request a new feature or enhancement +title: "<title>" +labels: + - feature + +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the feature you want. + options: + - label: I have searched the existing issues + required: true + + - type: textarea + attributes: + label: How would this feature be useful? + description: Describe any use cases this solves or frustrations it alleviates. + validations: + required: false + + - type: textarea + attributes: + label: Describe the solution you'd like + description: If you have an idea on how to do this, let us know here! + validations: + required: false + + - type: textarea + attributes: + label: Describe alternatives you've considered + description: If there's some workaround or alternative solutions, let us know here! + validations: + required: false + + - type: textarea + attributes: + label: Anything else? + description: Any other relevant information or background. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..6fb83c1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,29 @@ +name: ❓ Question +description: Ask something about the project +title: "<title>" +labels: + - question + +body: + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the question you want to ask. + options: + - label: I have searched the existing issues + required: true + + - type: textarea + attributes: + label: Description + description: Ask your question here. + placeholder: How can I...? Is it possible to...? + validations: + required: false + + - type: textarea + attributes: + label: Anything else? + description: Any other relevant information or background. + validations: + required: false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..87a1742 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +## Summary + +<!-- Describe your changes in detail here, if it closes an open issue, include "Closes #<issue>" --> diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a91d087 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 + +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + + - package-ecosystem: gomod + directory: / + rebase-strategy: auto + schedule: + interval: weekly diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 0000000..f4c6132 --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,75 @@ +- name: breaking + description: Breaking Changes + color: bfd4f2 + +- name: bug + description: Something isn't working + color: d73a4a + +- name: build + description: Build System and Dependencies + color: bfdadc + +- name: ci + description: Continuous Integration + color: 4a97d6 + +- name: dependencies + description: Pull requests that update a dependency file + color: 0366d6 + +- name: documentation + description: Improvements or additions to documentation + color: 0075ca + +- name: duplicate + description: This issue or pull request already exists + color: cfd3d7 + +- name: feature + description: New feature or request + color: a2eeef + +- name: good first issue + description: Good for newcomers + color: 7057ff + +- name: help wanted + description: Extra attention is needed + color: 008672 + +- name: invalid + description: This doesn't seem right + color: e4e669 + +- name: performance + description: Performance + color: "016175" + +- name: question + description: Further information is requested + color: d876e3 + +- name: refactoring + description: Refactoring + color: ef67c4 + +- name: removal + description: Removals and Deprecations + color: 9ae7ea + +- name: style + description: Style + color: c120e5 + +- name: chore + description: General project admin + color: cfd3d7 + +- name: testing + description: Testing + color: b1fc6f + +- name: wontfix + description: This will not be worked on + color: ffffff diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..a9638e2 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,44 @@ +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" + +categories: + - title: ":boom: Breaking Changes" + label: breaking + + - title: ":rocket: Features" + labels: + - enhancement + - feature + + - title: ":fire: Removals and Deprecations" + label: removal + + - title: ":beetle: Fixes" + label: bug + + - title: ":racehorse: Performance" + label: performance + + - title: ":rotating_light: Testing" + label: testing + + - title: ":construction_worker: Continuous Integration" + label: ci + + - title: ":books: Documentation" + label: documentation + + - title: ":hammer: Refactoring" + label: refactoring + + - title: ":lipstick: Style" + label: style + + - title: ":package: Dependencies" + labels: + - dependencies + - build + +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..12c6dcf --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,107 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + test: + name: Test + runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Install tparse + run: go install github.com/mfridman/tparse@latest + + - name: Run Tests + shell: bash # For pipefail + run: go test -race -json -cover -covermode=atomic ./... | tparse -format markdown >> $GITHUB_STEP_SUMMARY + + cov: + name: CodeCov + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Run Tests + run: go test -race -cover -covermode=atomic -coverprofile=./coverage.out ./... + + - name: Coverage + uses: codecov/codecov-action@v4 + with: + files: ./coverage.out + token: ${{ secrets.CODECOV_TOKEN }} + + lint: + name: Lint + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Run Linting + uses: golangci/golangci-lint-action@v6 + with: + version: latest + + vulncheck: + name: Vulncheck + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Install govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - name: Run govulncheck + run: govulncheck ./... diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..2d76325 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,25 @@ +name: Labeler + +on: + push: + branches: + - main + +permissions: {} + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Run Labeler + uses: crazy-max/ghaction-github-labeler@v5 + with: + skip-delete: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..679fe4d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + +permissions: {} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Fetch Existing Tags + run: git fetch --force --tags + + - name: Parse Release Version + id: version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Publish Draft Release + uses: release-drafter/release-drafter@v6 + with: + version: ${{ steps.version.outputs.version }} + publish: true + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release_drafter.yml b/.github/workflows/release_drafter.yml new file mode 100644 index 0000000..a71792d --- /dev/null +++ b/.github/workflows/release_drafter.yml @@ -0,0 +1,27 @@ +name: Release Drafter + +on: + push: + branches: + - main + pull_request: + types: + - opened + - reopened + - synchronize + +permissions: {} + +jobs: + draft_release: + name: Draft Release + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + + steps: + - name: Run Release Drafter + uses: release-drafter/release-drafter@v6 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..bdc45d5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,216 @@ +# Created by https://www.toptal.com/developers/gitignore/api/macos,windows,linux,visualstudiocode,jetbrains+all,go +# Edit at https://www.toptal.com/developers/gitignore?templates=macos,windows,linux,visualstudiocode,jetbrains+all,go + +### Go ### +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out +coverage.html + +# Taskfile +.task + +# Comparative benchmarks +before.txt +after.txt + +# Dependency directories (remove the comment below to include it) +# vendor/ + +# Go workspace file +go.work + +### JetBrains+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# AWS User-specific +.idea/**/aws.xml + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/jarRepositories.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# SonarLint plugin +.idea/sonarlint/ + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +### JetBrains+all Patch ### +# Ignore everything but code style settings and run configurations +# that are supposed to be shared within teams. + +.idea/* + +!.idea/codeStyles +!.idea/runConfigurations + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# End of https://www.toptal.com/developers/gitignore/api/macos,windows,linux,visualstudiocode,jetbrains+all,go diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..5218106 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,126 @@ +linters: + disable-all: true + enable: + - bodyclose + - containedctx + - durationcheck + - errcheck + - errchkjson + - errname + - exhaustive + - goconst + - gocritic + - gocyclo + - godot + - gofumpt + - goimports + - gosimple + - govet + - ineffassign + - misspell + - mnd + - nilerr + - nilnil + - nolintlint + - nakedret + - predeclared + - reassign + - revive + - staticcheck + - tagliatelle + - tenv + - testpackage + - thelper + - unconvert + - unparam + - unused + - whitespace + +linters-settings: + errcheck: + check-type-assertions: true + check-blank: true + + exhaustive: + check: + - switch + - map + default-signifies-exhaustive: true + + gocyclo: + min-complexity: 20 + + staticcheck: + checks: ["all"] + + gosimple: + checks: ["all"] + + govet: + enable-all: true + + revive: + max-open-files: 256 + ignore-generated-header: true + rules: + - name: argument-limit + disabled: false + arguments: [5] + + - name: atomic + disabled: false + + - name: blank-imports + disabled: false + + - name: call-to-gc + disabled: false + + - name: constant-logical-expr + disabled: false + + - name: context-as-argument + disabled: false + + - name: datarace + disabled: false + + - name: deep-exit + disabled: false + + - name: defer + disabled: false + + - name: dot-imports + disabled: false + + - name: early-return + disabled: false + + - name: exported + arguments: + - checkPrivateReceivers + + - name: modifies-value-receiver + disabled: false + + - name: package-comments + disabled: false + + - name: range + disabled: false + + - name: range-val-in-closure + disabled: false + + - name: range-val-address + disabled: false + + - name: time-equal + disabled: false + + - name: use-any + disabled: false + + - name: waitgroup-by-value + disabled: false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..308431c --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ + +MIT License + +Copyright (c) 2024, Tom Fleet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f147131 --- /dev/null +++ b/README.md @@ -0,0 +1,49 @@ +# snapshot + +[![License](https://img.shields.io/github/license/FollowTheProcess/snapshot)](https://github.com/FollowTheProcess/snapshot) +[![Go Reference](https://pkg.go.dev/badge/github.com/FollowTheProcess/snapshot.svg)](https://pkg.go.dev/github.com/FollowTheProcess/snapshot) +[![Go Report Card](https://goreportcard.com/badge/github.com/FollowTheProcess/snapshot)](https://goreportcard.com/report/github.com/FollowTheProcess/snapshot) +[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/snapshot?logo=github&sort=semver)](https://github.com/FollowTheProcess/snapshot) +[![CI](https://github.com/FollowTheProcess/snapshot/workflows/CI/badge.svg)](https://github.com/FollowTheProcess/snapshot/actions?query=workflow%3ACI) +[![codecov](https://codecov.io/gh/FollowTheProcess/snapshot/branch/main/graph/badge.svg)](https://codecov.io/gh/FollowTheProcess/snapshot) + +Simple, intuitive snapshot testing with Go 📸 + +> [!WARNING] +> **snapshot is in early development and is not yet ready for use** + +![caution](./img/caution.png) + +## Project Description + +Snapshot testing is where you assert the result of your code is identical to a specific reference value... which is basically *all* testing. If you've ever written: + +```go +if got != want { + t.Errorf("got %v, wanted %v", got, want) +} +``` + +Then congratulations, you've done snapshot testing 🎉 In this case `want` is the snapshot. + +The trick is, when these values get large or complicated, it's difficult to manually create and maintain the snapshot every time. The next jump up is what's typically +called "golden files". + +These are files (typically manually created) that contain the expected output, any difference in what your code produces to what's in the file is an error. + +Think of snapshot testing as an automated, configurable, and simple way of managing golden files. All you need to do is call `snapshot.Test(t, value)` and everything is handled for you! + +## Installation + +```shell +go get github.com/FollowTheProcess/snapshot@latest +``` + +## Quickstart + +### Credits + +This package was created with [copier] and the [FollowTheProcess/go_copier] project template. + +[copier]: https://copier.readthedocs.io/en/stable/ +[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..92c3bd1 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,97 @@ +# https://taskfile.dev + +version: "3" + +vars: + COV_DATA: coverage.out + +tasks: + default: + desc: List all available tasks + silent: true + cmds: + - task --list + + tidy: + desc: Tidy dependencies in go.mod and go.sum + sources: + - "**/*.go" + - go.mod + - go.sum + cmds: + - go mod tidy + + fmt: + desc: Run go fmt on all source files + sources: + - "**/*.go" + preconditions: + - sh: command -v golines + msg: golines not installed, see https://github.com/segmentio/golines + cmds: + - go fmt ./... + - golines . --ignore-generated --write-output + + test: + desc: Run the test suite + sources: + - "**/*.go" + cmds: + - go test -race ./... {{ .CLI_ARGS }} + + bench: + desc: Run all project benchmarks + sources: + - "**/*.go" + cmds: + - go test ./... -run None -benchmem -bench . {{ .CLI_ARGS }} + + lint: + desc: Run the linters and auto-fix if possible + sources: + - "**/*.go" + - .golangci.yml + cmds: + - golangci-lint run --fix + preconditions: + - sh: command -v golangci-lint + msg: golangci-lint not installed, see https://golangci-lint.run/usage/install/#local-installation + + doc: + desc: Render the pkg docs locally + cmds: + - pkgsite -open + preconditions: + - sh: command -v pkgsite + msg: pkgsite not installed, run go install golang.org/x/pkgsite/cmd/pkgsite@latest + + cov: + desc: Calculate test coverage and render the html + generates: + - "{{ .COV_DATA }}" + cmds: + - go test -race -cover -covermode atomic -coverprofile {{ .COV_DATA }} ./... + - go tool cover -html {{ .COV_DATA }} + + check: + desc: Run tests and linting in one + cmds: + - task: test + - task: lint + + sloc: + desc: Print lines of code + cmds: + - fd . -e go | xargs wc -l | sort -nr | head + + clean: + desc: Remove build artifacts and other clutter + cmds: + - go clean ./... + - rm -rf {{ .COV_DATA }} + + update: + desc: Updates dependencies in go.mod and go.sum + cmds: + - go get -u ./... + - go mody tidy diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7e08d3f --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/FollowTheProcess/snapshot + +go 1.23 \ No newline at end of file diff --git a/img/caution.png b/img/caution.png new file mode 100644 index 0000000..cdb9faa Binary files /dev/null and b/img/caution.png differ diff --git a/snapshot.go b/snapshot.go new file mode 100644 index 0000000..c3d6cf7 --- /dev/null +++ b/snapshot.go @@ -0,0 +1,7 @@ +// Package snapshot is a placeholder for something cool. +package snapshot + +// Hello returns a welcome message for the project. +func Hello() string { + return "Hello snapshot" +} diff --git a/snapshot_test.go b/snapshot_test.go new file mode 100644 index 0000000..5f37f2e --- /dev/null +++ b/snapshot_test.go @@ -0,0 +1,16 @@ +package snapshot_test + +import ( + "testing" + + "github.com/FollowTheProcess/snapshot" +) + +func TestHello(t *testing.T) { + got := snapshot.Hello() + want := "Hello snapshot" + + if got != want { + t.Errorf("got %s, wanted %s", got, want) + } +}