success

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 2 Imported by: 5

README

success

Go Reference GitHub build and test Go Report Card Coverage

This tiny Go module improves your testing feng shui tremendiously by shimming in Gomega error detection whenever trying to be Successful(). All your software will immediately look so much better by importing success!

For devcontainer instructions, please see the section "DevContainer" below.

Before
sekret, err := Foo(42)
Expect(err).NotTo(HaveOccured())
After
// You might want to dot-import for convenience.
import . "github.com/thediveo/success"

sekret := Successful(Foo(42))

// analogous...
sekret, moresekret := Successful2R(Bar(12345))
sekret, moresekret, nosekretanymore := Successful3R(Baz())

DevContainer

[!CAUTION]

Do not use VSCode's "Dev Containers: Clone Repository in Container Volume" command, as it is utterly broken by design, ignoring .devcontainer/devcontainer.json.

  1. git clone https://github.com/thediveo/enumflag
  2. in VSCode: Ctrl+Shift+P, "Dev Containers: Open Workspace in Container..."
  3. select enumflag.code-workspace and off you go...

Go Version Support

success supports versions of Go that are noted by the Go release policy, that is, major versions N and N-1 (where N is the current major version).

success is Copyright 2023 Harald Albrecht, and licensed under the Apache License, Version 2.0.

Documentation

Overview

Package success improves your testing feng shui tremendiously by shimming in Gomega error detection whenever trying to be Successful().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Successful

func Successful[R any](r R, err error) R

Successful takes a return value together with an error return value, returning only the value (without the error return value) and at the same time asserting that the error return value is nil.

func Successful2R

func Successful2R[R1 any, R2 any](r1 R1, r2 R2, err error) (R1, R2)

Successful2R takes two return values together with an error return value, returning only both value (without the error return value) and at the same time asserting that the error return value is nil.

func Successful3R

func Successful3R[R1 any, R2 any, R3 any](r1 R1, r2 R2, r3 R3, err error) (R1, R2, R3)

Successful2R takes two return values together with an error return value, returning only both value (without the error return value) and at the same time asserting that the error return value is nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL