feat: per-file example tests — action, registry, fs, api, string, path, service, error, array
33 new examples across 8 dedicated files. Removed phantom CleanPath
(in RFC spec but never implemented — spec drift caught by examples).
545 tests total, 84.8% coverage. Every major primitive has compilable
examples that serve as test, documentation seed, and godoc content.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 18:29:24 +00:00
|
|
|
package core_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
. "dappco.re/go/core"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func ExampleE() {
|
|
|
|
|
err := E("cache.Get", "key not found", nil)
|
|
|
|
|
fmt.Println(Operation(err))
|
|
|
|
|
fmt.Println(ErrorMessage(err))
|
|
|
|
|
// Output:
|
|
|
|
|
// cache.Get
|
|
|
|
|
// key not found
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleWrap() {
|
2026-03-25 18:49:55 +00:00
|
|
|
cause := NewError("connection refused")
|
feat: per-file example tests — action, registry, fs, api, string, path, service, error, array
33 new examples across 8 dedicated files. Removed phantom CleanPath
(in RFC spec but never implemented — spec drift caught by examples).
545 tests total, 84.8% coverage. Every major primitive has compilable
examples that serve as test, documentation seed, and godoc content.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 18:29:24 +00:00
|
|
|
err := Wrap(cause, "database.Connect", "failed to reach host")
|
|
|
|
|
fmt.Println(Operation(err))
|
2026-03-25 18:49:55 +00:00
|
|
|
fmt.Println(Is(err, cause))
|
feat: per-file example tests — action, registry, fs, api, string, path, service, error, array
33 new examples across 8 dedicated files. Removed phantom CleanPath
(in RFC spec but never implemented — spec drift caught by examples).
545 tests total, 84.8% coverage. Every major primitive has compilable
examples that serve as test, documentation seed, and godoc content.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 18:29:24 +00:00
|
|
|
// Output:
|
|
|
|
|
// database.Connect
|
|
|
|
|
// true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ExampleRoot() {
|
2026-03-25 18:49:55 +00:00
|
|
|
cause := NewError("original")
|
feat: per-file example tests — action, registry, fs, api, string, path, service, error, array
33 new examples across 8 dedicated files. Removed phantom CleanPath
(in RFC spec but never implemented — spec drift caught by examples).
545 tests total, 84.8% coverage. Every major primitive has compilable
examples that serve as test, documentation seed, and godoc content.
Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-25 18:29:24 +00:00
|
|
|
wrapped := Wrap(cause, "op1", "first wrap")
|
|
|
|
|
double := Wrap(wrapped, "op2", "second wrap")
|
|
|
|
|
fmt.Println(Root(double))
|
|
|
|
|
// Output: original
|
|
|
|
|
}
|