ch5ex19

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: GPL-3.0 Imports: 0 Imported by: 0

README

= Exercise 5.19
// Refs:
:url-base: https://github.com/fenegroni/TGPL-exercise-solutions
:workflow: workflows/Exercise 5.19
:action: actions/workflows/ch5ex19.yml
:url-workflow: {url-base}/{workflow}
:url-action: {url-base}/{action}
:badge-exercise: image:{url-workflow}/badge.svg?branch=main[link={url-action}]

{badge-exercise}

Use `panic` and `recover` to write a function that contains no `return` statement
yet returns a non-zero value.

== Test

Because a function with a return value will not compile if it does not contain a return statement,
the test will validate that `panic` was called by comparing the result of `recover` to a known value.

=== No return

The function under test `NoReturnStatement` receives an argument and
calls `panic` with that argument.

`TestNoReturnStatement` calls `NoReturnStatement` with a known value and
checks that `recover` returns that argument.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoReturnStatement

func NoReturnStatement(arg int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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