Enchantrix/examples/examples_test.go
google-labs-jules[bot] 33e7fa1e17 test: Improve test coverage and add examples
Improves the test coverage of the project and adds examples for coverage reports.

- Increases the test coverage of the `cmd/trix` package from 67.7% to 78.1%.
- Increases the test coverage of the `pkg/crypt` package from 96.2% to 98.7%.
- Adds tests for the `examples` to ensure they run without errors.
- Adds a new example that demonstrates how to generate and interpret a coverage report.
2025-11-13 19:51:11 +00:00

57 lines
1.4 KiB
Go

package examples_test
import (
"os/exec"
"testing"
"github.com/stretchr/testify/assert"
)
func TestExample_Checksums(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./checksums"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_Hash(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./hash"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_PGPEncryptDecrypt(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./pgp_encrypt_decrypt"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_PGPGenerateKeys(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./pgp_generate_keys"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_PGPSignVerify(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./pgp_sign_verify"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_PGPSymmetricEncrypt(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./pgp_symmetric_encrypt"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}
func TestExample_RSA(t *testing.T) {
cmd := exec.Command("go", "run", ".")
cmd.Dir = "./rsa"
out, err := cmd.CombinedOutput()
assert.NoError(t, err, string(out))
}