diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 86e9f61..f6e58a4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Six After, Inc +# Copyright (c) 2024-2025 Six After, Inc # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. @@ -32,7 +32,6 @@ jobs: steps: - name: Preamble run: | - whoami echo github ref $GITHUB_REF echo workflow $GITHUB_WORKFLOW echo home $HOME @@ -46,7 +45,7 @@ jobs: # Ref: https://github.com/actions/checkout - name: Checkout Source - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.github/workflows/codeql-analysis.yaml b/.github/workflows/codeql-analysis.yaml index a96e36b..26e939b 100644 --- a/.github/workflows/codeql-analysis.yaml +++ b/.github/workflows/codeql-analysis.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Six After, Inc +# Copyright (c) 2024-2025 Six After, Inc # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. @@ -48,7 +48,6 @@ jobs: steps: - name: Preamble run: | - whoami echo github ref $GITHUB_REF echo workflow $GITHUB_WORKFLOW echo home $HOME @@ -62,7 +61,7 @@ jobs: # Ref: https://github.com/actions/checkout - name: Checkout Source - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ceeb451..0b6233b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Six After, Inc +# Copyright (c) 2024-2025 Six After, Inc # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. @@ -25,7 +25,6 @@ jobs: steps: - name: "Preamble" run: | - whoami echo github ref $GITHUB_REF echo workflow $GITHUB_WORKFLOW echo home $HOME @@ -39,7 +38,7 @@ jobs: # Ref: https://github.com/actions/checkout - name: "Checkout Source" - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: fetch-depth: 0 diff --git a/.golangci.yaml b/.golangci.yaml index ea125eb..52a6923 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -1,3 +1,8 @@ +# Copyright (c) 2024-2025 Six After, Inc. +# +# This source code is licensed under the Apache 2.0 License found in the +# LICENSE file in the root directory of this source tree. + # Ref: https://golangci-lint.run/usage/configuration/ # See the dedicated "version" documentation section. diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 55e28d5..984c803 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,3 +1,8 @@ +# Copyright (c) 2024-2025 Six After, Inc. +# +# This source code is licensed under the Apache 2.0 License found in the +# LICENSE file in the root directory of this source tree. + # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=jcroql version: 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f83e6..02c1aff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,19 @@ Date format: `YYYY-MM-DD` ### Fixed ### Security +--- +## [0.8.0] - 2025-09-01 + +### Added +### Changed +- **debt:** Upgraded all dependencies to their latest stable versions. +- **risk:** Updated copyright to reflect date range through present year. + +### Deprecated +### Removed +### Fixed +### Security + --- ## [0.7.0] - 2025-08-14 @@ -128,7 +141,8 @@ Date format: `YYYY-MM-DD` ### Fixed ### Security -[Unreleased]: https://github.com/sixafter/graph/compare/v0.7.0...HEAD +[Unreleased]: https://github.com/sixafter/graph/compare/v0.8.0...HEAD +[0.8.0]: https://github.com/sixafter/graph/compare/v0.7.0...v0.8.0 [0.7.0]: https://github.com/sixafter/graph/compare/v0.6.0...v0.7.0 [0.6.0]: https://github.com/sixafter/graph/compare/v0.5.0...v0.6.0 [0.5.0]: https://github.com/sixafter/graph/compare/v0.4.1...v0.5.0 diff --git a/Makefile b/Makefile index 9a2b696..d076014 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (c) 2024 Six After, Inc. +# Copyright (c) 2024-2025 Six After, Inc. # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. diff --git a/doc.go b/doc.go index b952f2b..fe98edc 100644 --- a/doc.go +++ b/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/errors.go b/errors.go index 7b2ddf0..60a158e 100644 --- a/errors.go +++ b/errors.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/go.mod b/go.mod index e1d9017..00ec179 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. @@ -8,8 +8,8 @@ module github.com/sixafter/graph go 1.25 require ( - github.com/stretchr/testify v1.10.0 - golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 + github.com/stretchr/testify v1.11.1 + golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b ) require ( diff --git a/go.sum b/go.sum index dde4d32..6ab0873 100644 --- a/go.sum +++ b/go.sum @@ -2,10 +2,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 h1:SbTAbRFnd5kjQXbczszQ0hdk3ctwYf3qBNH9jIsGclE= -golang.org/x/exp v0.0.0-20250813145105-42675adae3e6/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b h1:DXr+pvt3nC887026GRP39Ej11UATqWDmWuS99x26cD0= +golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b/go.mod h1:4QTo5u+SEIbbKW1RacMZq1YEfOBqeXa19JeshGi+zc4= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/graph.go b/graph.go index 8da3dae..4677ca7 100644 --- a/graph.go +++ b/graph.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/hash.go b/hash.go index 9e459bf..b71d4fe 100644 --- a/hash.go +++ b/hash.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/hash_test.go b/hash_test.go index 90d1abd..75e6795 100644 --- a/hash_test.go +++ b/hash_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/internal/paths/paths.go b/internal/paths/paths.go index ed0446a..d65c0e2 100644 --- a/internal/paths/paths.go +++ b/internal/paths/paths.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/internal/queue/priority_queue.go b/internal/queue/priority_queue.go index 57397f4..4fa856d 100644 --- a/internal/queue/priority_queue.go +++ b/internal/queue/priority_queue.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/internal/queue/priority_queue_test.go b/internal/queue/priority_queue_test.go index 7fa0f74..8c42f23 100644 --- a/internal/queue/priority_queue_test.go +++ b/internal/queue/priority_queue_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/internal/queue/queue.go b/internal/queue/queue.go index 6248564..7a908bc 100644 --- a/internal/queue/queue.go +++ b/internal/queue/queue.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/internal/queue/queue_test.go b/internal/queue/queue_test.go index 1d620ae..bde922d 100644 --- a/internal/queue/queue_test.go +++ b/internal/queue/queue_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/io/doc.go b/io/doc.go index 0d06c49..eea5262 100644 --- a/io/doc.go +++ b/io/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/io/io.go b/io/io.go index 1813433..c17a3db 100644 --- a/io/io.go +++ b/io/io.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/average_path_length.go b/metrics/average_path_length.go index 43a3902..3faaa7f 100644 --- a/metrics/average_path_length.go +++ b/metrics/average_path_length.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/average_path_length_test.go b/metrics/average_path_length_test.go index 55d633a..d589849 100644 --- a/metrics/average_path_length_test.go +++ b/metrics/average_path_length_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/brandes.go b/metrics/brandes.go index d041400..0b1957a 100644 --- a/metrics/brandes.go +++ b/metrics/brandes.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/brandes_test.go b/metrics/brandes_test.go index 485303d..7add321 100644 --- a/metrics/brandes_test.go +++ b/metrics/brandes_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/closeness_centrality.go b/metrics/closeness_centrality.go index 110dc97..b7c6333 100644 --- a/metrics/closeness_centrality.go +++ b/metrics/closeness_centrality.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/clustering_coefficient.go b/metrics/clustering_coefficient.go index ec54dc4..fb9e66e 100644 --- a/metrics/clustering_coefficient.go +++ b/metrics/clustering_coefficient.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/clustering_coefficient_test.go b/metrics/clustering_coefficient_test.go index bf3506c..1089e44 100644 --- a/metrics/clustering_coefficient_test.go +++ b/metrics/clustering_coefficient_test.go @@ -1,6 +1,6 @@ // File: metrics/clustering_coefficient_test.go -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/degree_centrality.go b/metrics/degree_centrality.go index 20476d5..81117fc 100644 --- a/metrics/degree_centrality.go +++ b/metrics/degree_centrality.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/degree_centrality_test.go b/metrics/degree_centrality_test.go index 92d9b1c..18cd052 100644 --- a/metrics/degree_centrality_test.go +++ b/metrics/degree_centrality_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/density.go b/metrics/density.go index 0c6ee89..80ccb5c 100644 --- a/metrics/density.go +++ b/metrics/density.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/density_test.go b/metrics/density_test.go index 48c7b45..cb17cb0 100644 --- a/metrics/density_test.go +++ b/metrics/density_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/diameter.go b/metrics/diameter.go index a45e8b7..f761aaf 100644 --- a/metrics/diameter.go +++ b/metrics/diameter.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/diameter_test.go b/metrics/diameter_test.go index 5415149..270cd8a 100644 --- a/metrics/diameter_test.go +++ b/metrics/diameter_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/doc.go b/metrics/doc.go index 4fea7b1..d0da82f 100644 --- a/metrics/doc.go +++ b/metrics/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/eigenvector_centrality.go b/metrics/eigenvector_centrality.go index 56aaba5..4eaf479 100644 --- a/metrics/eigenvector_centrality.go +++ b/metrics/eigenvector_centrality.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/eigenvector_centrality_test.go b/metrics/eigenvector_centrality_test.go index 204e454..bfdbdf6 100644 --- a/metrics/eigenvector_centrality_test.go +++ b/metrics/eigenvector_centrality_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/global_clustering_coefficient.go b/metrics/global_clustering_coefficient.go index c6cd2a8..615f420 100644 --- a/metrics/global_clustering_coefficient.go +++ b/metrics/global_clustering_coefficient.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/global_clustering_coefficient_test.go b/metrics/global_clustering_coefficient_test.go index 42c3342..0992a5c 100644 --- a/metrics/global_clustering_coefficient_test.go +++ b/metrics/global_clustering_coefficient_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/modularity_test.go b/metrics/modularity_test.go index 74edc10..f6cf3f0 100644 --- a/metrics/modularity_test.go +++ b/metrics/modularity_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/page_rank.go b/metrics/page_rank.go index 89e790e..6274515 100644 --- a/metrics/page_rank.go +++ b/metrics/page_rank.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/page_rank_test.go b/metrics/page_rank_test.go index a1c5797..34b7b65 100644 --- a/metrics/page_rank_test.go +++ b/metrics/page_rank_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/transitivity.go b/metrics/transitivity.go index 4d4ac8e..63eb2fe 100644 --- a/metrics/transitivity.go +++ b/metrics/transitivity.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/metrics/transitivity_test.go b/metrics/transitivity_test.go index e7f9e6d..2619386 100644 --- a/metrics/transitivity_test.go +++ b/metrics/transitivity_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/dijkstra.go b/paths/dijkstra.go index f02e296..ddd1c0a 100644 --- a/paths/dijkstra.go +++ b/paths/dijkstra.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/dijkstra_test.go b/paths/dijkstra_test.go index 2cd56be..c02f83c 100644 --- a/paths/dijkstra_test.go +++ b/paths/dijkstra_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/doc.go b/paths/doc.go index dbd51ca..b55db5d 100644 --- a/paths/doc.go +++ b/paths/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/find_all.go b/paths/find_all.go index d0dd73c..ee0baa7 100644 --- a/paths/find_all.go +++ b/paths/find_all.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/find_all_test.go b/paths/find_all_test.go index 527a3e7..f49102c 100644 --- a/paths/find_all_test.go +++ b/paths/find_all_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/kruskal.go b/paths/kruskal.go index db64d4e..b043b63 100644 --- a/paths/kruskal.go +++ b/paths/kruskal.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/paths/kruskal_test.go b/paths/kruskal_test.go index 5c747e1..f452c33 100644 --- a/paths/kruskal_test.go +++ b/paths/kruskal_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/scripts/go-deps.sh b/scripts/go-deps.sh index f47c14a..c8aa471 100755 --- a/scripts/go-deps.sh +++ b/scripts/go-deps.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2024 Six After, Inc. +# Copyright (c) 2024-2025 Six After, Inc. # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. diff --git a/scripts/go-install.sh b/scripts/go-install.sh index c892aa0..6098937 100755 --- a/scripts/go-install.sh +++ b/scripts/go-install.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2024 Six After, Inc. +# Copyright (c) 2024-2025 Six After, Inc. # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. diff --git a/scripts/os-type.sh b/scripts/os-type.sh index 443c038..245bc7f 100755 --- a/scripts/os-type.sh +++ b/scripts/os-type.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) 2024 Six After, Inc. +# Copyright (c) 2024-2025 Six After, Inc. # # This source code is licensed under the Apache 2.0 License found in the # LICENSE file in the root directory of this source tree. diff --git a/sets/complement.go b/sets/complement.go index fb81a89..c6e2f4d 100644 --- a/sets/complement.go +++ b/sets/complement.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/complement_test.go b/sets/complement_test.go index 7b13a65..cfad2f2 100644 --- a/sets/complement_test.go +++ b/sets/complement_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/difference.go b/sets/difference.go index af42e1c..7643866 100644 --- a/sets/difference.go +++ b/sets/difference.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/difference_test.go b/sets/difference_test.go index ad5acf6..ad33295 100644 --- a/sets/difference_test.go +++ b/sets/difference_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/disjoint.go b/sets/disjoint.go index ed52b0d..74da449 100644 --- a/sets/disjoint.go +++ b/sets/disjoint.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/disjoint_test.go b/sets/disjoint_test.go index a8a0faf..be02f22 100644 --- a/sets/disjoint_test.go +++ b/sets/disjoint_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/doc.go b/sets/doc.go index 71d23f8..1b56a27 100644 --- a/sets/doc.go +++ b/sets/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/equals.go b/sets/equals.go index 68665fd..7ceba5c 100644 --- a/sets/equals.go +++ b/sets/equals.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/equals_test.go b/sets/equals_test.go index 29f0e7f..cd38855 100644 --- a/sets/equals_test.go +++ b/sets/equals_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/intersection.go b/sets/intersection.go index f4cf537..44395f3 100644 --- a/sets/intersection.go +++ b/sets/intersection.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/intersection_test.go b/sets/intersection_test.go index 5b3d1a7..32afb0e 100644 --- a/sets/intersection_test.go +++ b/sets/intersection_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/sets.go b/sets/sets.go index 991ce5b..fa191ae 100644 --- a/sets/sets.go +++ b/sets/sets.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/subset.go b/sets/subset.go index 9516d7b..b3eea67 100644 --- a/sets/subset.go +++ b/sets/subset.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/subset_test.go b/sets/subset_test.go index 62f68f3..d39067b 100644 --- a/sets/subset_test.go +++ b/sets/subset_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/superset.go b/sets/superset.go index c41e05a..63160fa 100644 --- a/sets/superset.go +++ b/sets/superset.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/superset_test.go b/sets/superset_test.go index eb88578..722ac14 100644 --- a/sets/superset_test.go +++ b/sets/superset_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/union.go b/sets/union.go index ad6f7bc..24cd80b 100644 --- a/sets/union.go +++ b/sets/union.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/sets/union_test.go b/sets/union_test.go index 0e35162..05488cf 100644 --- a/sets/union_test.go +++ b/sets/union_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/directed.go b/simple/directed.go index 2f515bb..e47343c 100644 --- a/simple/directed.go +++ b/simple/directed.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/directed_test.go b/simple/directed_test.go index 5fe9422..c0d5d10 100644 --- a/simple/directed_test.go +++ b/simple/directed_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/doc.go b/simple/doc.go index 82a1007..9c9db24 100644 --- a/simple/doc.go +++ b/simple/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/ledger.go b/simple/ledger.go index d9ab78a..f37765a 100644 --- a/simple/ledger.go +++ b/simple/ledger.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/ledger_memory.go b/simple/ledger_memory.go index e6635d0..8453f27 100644 --- a/simple/ledger_memory.go +++ b/simple/ledger_memory.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/ledger_memory_test.go b/simple/ledger_memory_test.go index 401e284..5c51fb0 100644 --- a/simple/ledger_memory_test.go +++ b/simple/ledger_memory_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/simple.go b/simple/simple.go index 35228ed..94d9a87 100644 --- a/simple/simple.go +++ b/simple/simple.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/simple_test.go b/simple/simple_test.go index a0358bf..61c2eaa 100644 --- a/simple/simple_test.go +++ b/simple/simple_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/undirected.go b/simple/undirected.go index 2a92284..9f2f282 100644 --- a/simple/undirected.go +++ b/simple/undirected.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/simple/undirected_test.go b/simple/undirected_test.go index 15993f4..ac06270 100644 --- a/simple/undirected_test.go +++ b/simple/undirected_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/doc.go b/topology/doc.go index 40a6f74..3c2e51e 100644 --- a/topology/doc.go +++ b/topology/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/kahn.go b/topology/kahn.go index 7a4fbec..9723cae 100644 --- a/topology/kahn.go +++ b/topology/kahn.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/kahn_test.go b/topology/kahn_test.go index a5120d3..039902e 100644 --- a/topology/kahn_test.go +++ b/topology/kahn_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/reduce.go b/topology/reduce.go index 598c336..80d9ce8 100644 --- a/topology/reduce.go +++ b/topology/reduce.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/reduce_test.go b/topology/reduce_test.go index 2f1cc35..a4838b3 100644 --- a/topology/reduce_test.go +++ b/topology/reduce_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/tarjan.go b/topology/tarjan.go index 32aa955..0e5b493 100644 --- a/topology/tarjan.go +++ b/topology/tarjan.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/topology/tarjan_test.go b/topology/tarjan_test.go index 82b3ec6..79b8577 100644 --- a/topology/tarjan_test.go +++ b/topology/tarjan_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/traits.go b/traits.go index 576d3e2..a48a9ac 100644 --- a/traits.go +++ b/traits.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ type Traits struct { // IsMultiGraph indicates whether the graph is a multigraph. A multigraph is a // graph that allows multiple edges between the same pair of vertices. IsMultiGraph bool - + // IsRooted indicates whether the graph is rooted. A rooted graph is a graph // with a designated root node, common in tree structures. IsRooted bool diff --git a/traits_test.go b/traits_test.go index 24063d9..91189d6 100644 --- a/traits_test.go +++ b/traits_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/traverse/bfs.go b/traverse/bfs.go index 511cf83..1dc5dfc 100644 --- a/traverse/bfs.go +++ b/traverse/bfs.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/traverse/bfs_test.go b/traverse/bfs_test.go index 852bd7b..9f00e76 100644 --- a/traverse/bfs_test.go +++ b/traverse/bfs_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/traverse/dfs.go b/traverse/dfs.go index 3389f45..57bfe0a 100644 --- a/traverse/dfs.go +++ b/traverse/dfs.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/traverse/doc.go b/traverse/doc.go index 3d5e61f..cf66c6e 100644 --- a/traverse/doc.go +++ b/traverse/doc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2024 Six After, Inc +// Copyright (c) 2024-2025 Six After, Inc // // This source code is licensed under the Apache 2.0 License found in the // LICENSE file in the root directory of this source tree. diff --git a/vendor/github.com/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go index 7e19eba..ffb24e8 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_compare.go @@ -390,7 +390,8 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater}, failMessage, msgAndArgs...) } // GreaterOrEqual asserts that the first element is greater than or equal to the second @@ -403,7 +404,8 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not greater than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareGreater, compareEqual}, failMessage, msgAndArgs...) } // Less asserts that the first element is less than the second @@ -415,7 +417,8 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess}, failMessage, msgAndArgs...) } // LessOrEqual asserts that the first element is less than or equal to the second @@ -428,7 +431,8 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter if h, ok := t.(tHelper); ok { h.Helper() } - return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not less than or equal to \"%v\"", e1, e2) + return compareTwoValues(t, e1, e2, []compareResult{compareLess, compareEqual}, failMessage, msgAndArgs...) } // Positive asserts that the specified element is positive @@ -440,7 +444,8 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, "\"%v\" is not positive", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not positive", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareGreater}, failMessage, msgAndArgs...) } // Negative asserts that the specified element is negative @@ -452,7 +457,8 @@ func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { h.Helper() } zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, "\"%v\" is not negative", msgAndArgs...) + failMessage := fmt.Sprintf("\"%v\" is not negative", e) + return compareTwoValues(t, e, zero.Interface(), []compareResult{compareLess}, failMessage, msgAndArgs...) } func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []compareResult, failMessage string, msgAndArgs ...interface{}) bool { @@ -468,11 +474,11 @@ func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedCompare compareResult, isComparable := compare(e1, e2, e1Kind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T"`, e1), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) + return Fail(t, failMessage, msgAndArgs...) } return true diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go index 1906341..c592f6a 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_format.go @@ -50,10 +50,19 @@ func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Emptyf(t, obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -117,10 +126,8 @@ func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg stri // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Errorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// assert.Errorf(t, err, "error message %s", "formatted") func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -438,7 +445,19 @@ func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interf return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) } +// IsNotTypef asserts that the specified objects are not of the same type. +// +// assert.IsNotTypef(t, &NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func IsNotTypef(t TestingT, theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := t.(tHelper); ok { + h.Helper() + } + return IsNotType(t, theType, object, append([]interface{}{msg}, args...)...) +} + // IsTypef asserts that the specified objects are of the same type. +// +// assert.IsTypef(t, &MyStruct{}, &MyStruct{}, "error message %s", "formatted") func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -585,8 +604,7 @@ func NotElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg str return NotElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if assert.NotEmptyf(t, obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -693,12 +711,15 @@ func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") // assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// assert.NotSubsetf(t, [1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.NotSubsetf(t, {"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() @@ -782,11 +803,15 @@ func Samef(t TestingT, expected interface{}, actual interface{}, msg string, arg return Same(t, expected, actual, append([]interface{}{msg}, args...)...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") // assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// assert.Subsetf(t, [1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// assert.Subsetf(t, {"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go index 2162908..58db928 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -92,10 +92,19 @@ func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg st return ElementsMatchf(a.t, listA, listB, msg, args...) } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Empty(obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -103,10 +112,19 @@ func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { return Empty(a.t, object, msgAndArgs...) } -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Emptyf asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // a.Emptyf(obj, "error message %s", "formatted") +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -224,10 +242,8 @@ func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// a.Error(err) func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -297,10 +313,8 @@ func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...inter // Errorf asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } +// actualObj, err := SomeFunction() +// a.Errorf(err, "error message %s", "formatted") func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -868,7 +882,29 @@ func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...in return IsNonIncreasingf(a.t, object, msg, args...) } +// IsNotType asserts that the specified objects are not of the same type. +// +// a.IsNotType(&NotMyStruct{}, &MyStruct{}) +func (a *Assertions) IsNotType(theType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotType(a.t, theType, object, msgAndArgs...) +} + +// IsNotTypef asserts that the specified objects are not of the same type. +// +// a.IsNotTypef(&NotMyStruct{}, &MyStruct{}, "error message %s", "formatted") +func (a *Assertions) IsNotTypef(theType interface{}, object interface{}, msg string, args ...interface{}) bool { + if h, ok := a.t.(tHelper); ok { + h.Helper() + } + return IsNotTypef(a.t, theType, object, msg, args...) +} + // IsType asserts that the specified objects are of the same type. +// +// a.IsType(&MyStruct{}, &MyStruct{}) func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -877,6 +913,8 @@ func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAnd } // IsTypef asserts that the specified objects are of the same type. +// +// a.IsTypef(&MyStruct{}, &MyStruct{}, "error message %s", "formatted") func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1162,8 +1200,7 @@ func (a *Assertions) NotElementsMatchf(listA interface{}, listB interface{}, msg return NotElementsMatchf(a.t, listA, listB, msg, args...) } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if a.NotEmpty(obj) { // assert.Equal(t, "two", obj[1]) @@ -1175,8 +1212,7 @@ func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) boo return NotEmpty(a.t, object, msgAndArgs...) } -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmptyf asserts that the specified object is NOT [Empty]. // // if a.NotEmptyf(obj, "error message %s", "formatted") { // assert.Equal(t, "two", obj[1]) @@ -1378,12 +1414,15 @@ func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg stri return NotSamef(a.t, expected, actual, msg, args...) } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubset([1, 3, 4], [1, 2]) // a.NotSubset({"x": 1, "y": 2}, {"z": 3}) +// a.NotSubset([1, 3, 4], {1: "one", 2: "two"}) +// a.NotSubset({"x": 1, "y": 2}, ["z"]) func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1391,12 +1430,15 @@ func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs return NotSubset(a.t, list, subset, msgAndArgs...) } -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubsetf asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") // a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") +// a.NotSubsetf([1, 3, 4], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.NotSubsetf({"x": 1, "y": 2}, ["z"], "error message %s", "formatted") func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1556,11 +1598,15 @@ func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, return Samef(a.t, expected, actual, msg, args...) } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subset([1, 2, 3], [1, 2]) // a.Subset({"x": 1, "y": 2}, {"x": 1}) +// a.Subset([1, 2, 3], {1: "one", 2: "two"}) +// a.Subset({"x": 1, "y": 2}, ["x"]) func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() @@ -1568,11 +1614,15 @@ func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ... return Subset(a.t, list, subset, msgAndArgs...) } -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subsetf asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") // a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") +// a.Subsetf([1, 2, 3], {1: "one", 2: "two"}, "error message %s", "formatted") +// a.Subsetf({"x": 1, "y": 2}, ["x"], "error message %s", "formatted") func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { if h, ok := a.t.(tHelper); ok { h.Helper() diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go index 1d2f718..2fdf80f 100644 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ b/vendor/github.com/stretchr/testify/assert/assertion_order.go @@ -33,7 +33,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []compareR compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) + return Fail(t, fmt.Sprintf(`Can not compare type "%T" and "%T"`, value, prevValue), msgAndArgs...) } if !containsValue(allowedComparesResults, compareResult) { diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go index 4e91332..de8de0c 100644 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -210,59 +210,77 @@ the problem actually occurred in calling code.*/ // of each stack frame leading from the current test to the assert call that // failed. func CallerInfo() []string { - var pc uintptr - var ok bool var file string var line int var name string + const stackFrameBufferSize = 10 + pcs := make([]uintptr, stackFrameBufferSize) + callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - // The breaks below failed to terminate the loop, and we ran off the - // end of the call stack. - break - } + offset := 1 - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } + for { + n := runtime.Callers(offset, pcs) - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { + if n == 0 { break } - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + frames := runtime.CallersFrames(pcs[:n]) + + for { + frame, more := frames.Next() + pc = frame.PC + file = frame.File + line = frame.Line + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break } - } - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + if len(parts) > 1 { + filename := parts[len(parts)-1] + dir := parts[len(parts)-2] + if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + } + + // Drop the package + dotPos := strings.LastIndexByte(name, '.') + name = name[dotPos+1:] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + + if !more { + break + } } + + // Next batch + offset += cap(pcs) } return callers @@ -437,17 +455,34 @@ func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, return true } +func isType(expectedType, object interface{}) bool { + return ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) +} + // IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { +// +// assert.IsType(t, &MyStruct{}, &MyStruct{}) +func IsType(t TestingT, expectedType, object interface{}, msgAndArgs ...interface{}) bool { + if isType(expectedType, object) { + return true + } if h, ok := t.(tHelper); ok { h.Helper() } + return Fail(t, fmt.Sprintf("Object expected to be of type %T, but was %T", expectedType, object), msgAndArgs...) +} - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) +// IsNotType asserts that the specified objects are not of the same type. +// +// assert.IsNotType(t, &NotMyStruct{}, &MyStruct{}) +func IsNotType(t TestingT, theType, object interface{}, msgAndArgs ...interface{}) bool { + if !isType(theType, object) { + return true } - - return true + if h, ok := t.(tHelper); ok { + h.Helper() + } + return Fail(t, fmt.Sprintf("Object type expected to be different than %T", theType), msgAndArgs...) } // Equal asserts that two objects are equal. @@ -475,7 +510,6 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) } return true - } // validateEqualArgs checks whether provided arguments can be safely used in the @@ -510,8 +544,9 @@ func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) b if !same { // both are pointers but not the same type & pointing to the same address return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#v\n"+ - "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) + "expected: %p %#[1]v\n"+ + "actual : %p %#[2]v", + expected, actual), msgAndArgs...) } return true @@ -530,14 +565,14 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} same, ok := samePointers(expected, actual) if !ok { - //fails when the arguments are not pointers + // fails when the arguments are not pointers return !(Fail(t, "Both arguments must be pointers", msgAndArgs...)) } if same { return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#v", - expected, expected), msgAndArgs...) + "Expected and actual point to the same object: %p %#[1]v", + expected), msgAndArgs...) } return true } @@ -549,7 +584,7 @@ func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} func samePointers(first, second interface{}) (same bool, ok bool) { firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false, false //not both are pointers + return false, false // not both are pointers } firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) @@ -610,7 +645,6 @@ func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interfa } return true - } // EqualExportedValues asserts that the types of two objects are equal and their public @@ -665,7 +699,6 @@ func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{} } return Equal(t, expected, actual, msgAndArgs...) - } // NotNil asserts that the specified object is not nil. @@ -715,37 +748,45 @@ func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { // isEmpty gets whether the specified object is considered empty or not. func isEmpty(object interface{}) bool { - // get nil case out of the way if object == nil { return true } - objValue := reflect.ValueOf(object) + return isEmptyValue(reflect.ValueOf(object)) +} +// isEmptyValue gets whether the specified reflect.Value is considered empty or not. +func isEmptyValue(objValue reflect.Value) bool { + if objValue.IsZero() { + return true + } + // Special cases of non-zero values that we consider empty switch objValue.Kind() { // collection types are empty when they have no element + // Note: array types are empty when they match their zero-initialized state. case reflect.Chan, reflect.Map, reflect.Slice: return objValue.Len() == 0 - // pointers are empty if nil or if the value they point to is empty + // non-nil pointers are empty if the value they point to is empty case reflect.Ptr: - if objValue.IsNil() { - return true - } - deref := objValue.Elem().Interface() - return isEmpty(deref) - // for all other types, compare against the zero value - // array types are empty when they match their zero-initialized state - default: - zero := reflect.Zero(objValue.Type()) - return reflect.DeepEqual(object, zero.Interface()) + return isEmptyValue(objValue.Elem()) } + return false } -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. +// Empty asserts that the given value is "empty". +// +// [Zero values] are "empty". +// +// Arrays are "empty" if every element is the zero value of the type (stricter than "empty"). +// +// Slices, maps and channels with zero length are "empty". +// +// Pointer values are "empty" if the pointer is nil or if the pointed value is "empty". // // assert.Empty(t, obj) +// +// [Zero values]: https://go.dev/ref/spec#The_zero_value func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { pass := isEmpty(object) if !pass { @@ -756,11 +797,9 @@ func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. +// NotEmpty asserts that the specified object is NOT [Empty]. // // if assert.NotEmpty(t, obj) { // assert.Equal(t, "two", obj[1]) @@ -775,7 +814,6 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { } return pass - } // getLen tries to get the length of an object. @@ -819,7 +857,6 @@ func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // False asserts that the specified value is false. @@ -834,7 +871,6 @@ func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { } return true - } // NotEqual asserts that the specified values are NOT equal. @@ -857,7 +893,6 @@ func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{ } return true - } // NotEqualValues asserts that two objects are not equal even when converted to the same type @@ -880,7 +915,6 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte // return (true, false) if element was not found. // return (true, true) if element was found. func containsElement(list interface{}, element interface{}) (ok, found bool) { - listValue := reflect.ValueOf(list) listType := reflect.TypeOf(list) if listType == nil { @@ -915,7 +949,6 @@ func containsElement(list interface{}, element interface{}) (ok, found bool) { } } return true, false - } // Contains asserts that the specified string, list(array, slice...) or map contains the @@ -938,7 +971,6 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo } return true - } // NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the @@ -961,14 +993,17 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) } return true - } -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. +// Subset asserts that the list (array, slice, or map) contains all elements +// given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.Subset(t, [1, 2, 3], [1, 2]) // assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) +// assert.Subset(t, [1, 2, 3], {1: "one", 2: "two"}) +// assert.Subset(t, {"x": 1, "y": 2}, ["x"]) func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -983,7 +1018,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1007,6 +1042,13 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) @@ -1021,12 +1063,15 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok return true } -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. +// NotSubset asserts that the list (array, slice, or map) does NOT contain all +// elements given in the subset (array, slice, or map). +// Map elements are key-value pairs unless compared with an array or slice where +// only the map key is evaluated. // // assert.NotSubset(t, [1, 3, 4], [1, 2]) // assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) +// assert.NotSubset(t, [1, 3, 4], {1: "one", 2: "two"}) +// assert.NotSubset(t, {"x": 1, "y": 2}, ["z"]) func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { if h, ok := t.(tHelper); ok { h.Helper() @@ -1041,7 +1086,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { + if subsetKind != reflect.Array && subsetKind != reflect.Slice && subsetKind != reflect.Map { return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) } @@ -1065,11 +1110,18 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) } subsetList := reflect.ValueOf(subset) + if subsetKind == reflect.Map { + keys := make([]interface{}, subsetList.Len()) + for idx, key := range subsetList.MapKeys() { + keys[idx] = key.Interface() + } + subsetList = reflect.ValueOf(keys) + } for i := 0; i < subsetList.Len(); i++ { element := subsetList.Index(i).Interface() ok, found := containsElement(list, element) if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) + return Fail(t, fmt.Sprintf("%q could not be applied builtin len()", list), msgAndArgs...) } if !found { return true @@ -1591,10 +1643,8 @@ func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { // Error asserts that a function returned an error (i.e. not `nil`). // -// actualObj, err := SomeFunction() -// if assert.Error(t, err) { -// assert.Equal(t, expectedError, err) -// } +// actualObj, err := SomeFunction() +// assert.Error(t, err) func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { if err == nil { if h, ok := t.(tHelper); ok { @@ -1667,7 +1717,6 @@ func matchRegexp(rx interface{}, str interface{}) bool { default: return r.MatchString(fmt.Sprint(v)) } - } // Regexp asserts that a specified regexp matches a string. @@ -1703,7 +1752,6 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf } return !match - } // Zero asserts that i is the zero value for its type. @@ -1814,6 +1862,11 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1832,6 +1885,11 @@ func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{ return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) } + // Shortcut if same bytes + if actual == expected { + return true + } + if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) } @@ -1933,6 +1991,7 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -1940,18 +1999,23 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return true } - tick = ticker.C + tickC = ticker.C } } } @@ -1964,6 +2028,9 @@ type CollectT struct { errors []error } +// Helper is like [testing.T.Helper] but does nothing. +func (CollectT) Helper() {} + // Errorf collects the error. func (c *CollectT) Errorf(format string, args ...interface{}) { c.errors = append(c.errors, fmt.Errorf(format, args...)) @@ -2021,35 +2088,42 @@ func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time var lastFinishedTickErrs []error ch := make(chan *CollectT, 1) + checkCond := func() { + collect := new(CollectT) + defer func() { + ch <- collect + }() + condition(collect) + } + timer := time.NewTimer(waitFor) defer timer.Stop() ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: for _, err := range lastFinishedTickErrs { t.Errorf("%v", err) } return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { - collect := new(CollectT) - defer func() { - ch <- collect - }() - condition(collect) - }() + case <-tickC: + tickC = nil + go checkCond() case collect := <-ch: if !collect.failed() { return true } // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. lastFinishedTickErrs = collect.errors - tick = ticker.C + tickC = ticker.C } } } @@ -2064,6 +2138,7 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D } ch := make(chan bool, 1) + checkCond := func() { ch <- condition() } timer := time.NewTimer(waitFor) defer timer.Stop() @@ -2071,18 +2146,23 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D ticker := time.NewTicker(tick) defer ticker.Stop() - for tick := ticker.C; ; { + var tickC <-chan time.Time + + // Check the condition once first on the initial call. + go checkCond() + + for { select { case <-timer.C: return true - case <-tick: - tick = nil - go func() { ch <- condition() }() + case <-tickC: + tickC = nil + go checkCond() case v := <-ch: if v { return Fail(t, "Condition satisfied", msgAndArgs...) } - tick = ticker.C + tickC = ticker.C } } } @@ -2100,9 +2180,12 @@ func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { var expectedText string if target != nil { expectedText = target.Error() + if err == nil { + return Fail(t, fmt.Sprintf("Expected error with %q in chain but got nil.", expectedText), msgAndArgs...) + } } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ "expected: %q\n"+ @@ -2125,7 +2208,7 @@ func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { expectedText = target.Error() } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, false) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ "found: %q\n"+ @@ -2143,11 +2226,17 @@ func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{ return true } - chain := buildErrorChainString(err) + expectedType := reflect.TypeOf(target).Elem().String() + if err == nil { + return Fail(t, fmt.Sprintf("An error is expected but got nil.\n"+ + "expected: %s", expectedType), msgAndArgs...) + } + + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %q\n"+ - "in chain: %s", target, chain, + "expected: %s\n"+ + "in chain: %s", expectedType, chain, ), msgAndArgs...) } @@ -2161,24 +2250,46 @@ func NotErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interfa return true } - chain := buildErrorChainString(err) + chain := buildErrorChainString(err, true) return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %q\n"+ - "in chain: %s", target, chain, + "found: %s\n"+ + "in chain: %s", reflect.TypeOf(target).Elem().String(), chain, ), msgAndArgs...) } -func buildErrorChainString(err error) string { +func unwrapAll(err error) (errs []error) { + errs = append(errs, err) + switch x := err.(type) { + case interface{ Unwrap() error }: + err = x.Unwrap() + if err == nil { + return + } + errs = append(errs, unwrapAll(err)...) + case interface{ Unwrap() []error }: + for _, err := range x.Unwrap() { + errs = append(errs, unwrapAll(err)...) + } + } + return +} + +func buildErrorChainString(err error, withType bool) string { if err == nil { return "" } - e := errors.Unwrap(err) - chain := fmt.Sprintf("%q", err.Error()) - for e != nil { - chain += fmt.Sprintf("\n\t%q", e.Error()) - e = errors.Unwrap(e) + var chain string + errs := unwrapAll(err) + for i := range errs { + if i != 0 { + chain += "\n\t" + } + chain += fmt.Sprintf("%q", errs[i].Error()) + if withType { + chain += fmt.Sprintf(" (%T)", errs[i]) + } } return chain } diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go index 4953981..a0b953a 100644 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -1,5 +1,9 @@ // Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. // +// # Note +// +// All functions in this package return a bool value indicating whether the assertion has passed. +// // # Example Usage // // The following is a complete example using assert in a standard test function: diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go index 861ed4b..5a6bb75 100644 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -138,7 +138,7 @@ func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, contains := strings.Contains(body, fmt.Sprint(str)) if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return contains @@ -158,7 +158,7 @@ func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url strin contains := strings.Contains(body, fmt.Sprint(str)) if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) + Fail(t, fmt.Sprintf("Expected response body for %q to NOT contain %q but found %q", url+"?"+values.Encode(), str, body), msgAndArgs...) } return !contains diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go index baa0cc7..5a74c4f 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go @@ -1,5 +1,4 @@ //go:build testify_yaml_custom && !testify_yaml_fail && !testify_yaml_default -// +build testify_yaml_custom,!testify_yaml_fail,!testify_yaml_default // Package yaml is an implementation of YAML functions that calls a pluggable implementation. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go index b83c6cf..0bae80e 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go @@ -1,5 +1,4 @@ //go:build !testify_yaml_fail && !testify_yaml_custom -// +build !testify_yaml_fail,!testify_yaml_custom // Package yaml is just an indirection to handle YAML deserialization. // diff --git a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go index e78f7df..8041803 100644 --- a/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go +++ b/vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go @@ -1,5 +1,4 @@ //go:build testify_yaml_fail && !testify_yaml_custom && !testify_yaml_default -// +build testify_yaml_fail,!testify_yaml_custom,!testify_yaml_default // Package yaml is an implementation of YAML functions that always fail. // diff --git a/vendor/modules.txt b/vendor/modules.txt index a359521..3219215 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -6,11 +6,11 @@ github.com/davecgh/go-spew/spew github.com/pmezard/go-difflib/difflib # github.com/stretchr/objx v0.5.2 ## explicit; go 1.20 -# github.com/stretchr/testify v1.10.0 +# github.com/stretchr/testify v1.11.1 ## explicit; go 1.17 github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml -# golang.org/x/exp v0.0.0-20250813145105-42675adae3e6 +# golang.org/x/exp v0.0.0-20250819193227-8b4c13bb791b ## explicit; go 1.24.0 golang.org/x/exp/constraints # gopkg.in/yaml.v3 v3.0.1