Skip to content

Commit

Permalink
Remove unused prettyJSON function in API test file
Browse files Browse the repository at this point in the history
- Deleted unused `prettyJSON` helper function from `internal/api/api_test.go`
- Simplified test file by removing unnecessary JSON formatting utility
- Kept `prettyPrint` function for struct formatting
  • Loading branch information
faddat committed Feb 1, 2025
1 parent 53217a0 commit b7e048a
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions internal/api/api_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package api

import (
"bytes"
"encoding/json"
"fmt"
"os"
Expand All @@ -12,19 +11,6 @@ import (
"github.com/CosmWasm/wasmvm/v2/types"
)

// prettyJSON returns a properly indented JSON string for debugging
func prettyJSON(data []byte) string {
if !json.Valid(data) {
return fmt.Sprintf("%q", string(data))
}
var prettyJSON bytes.Buffer
err := json.Indent(&prettyJSON, data, "", " ")
if err != nil {
return fmt.Sprintf("%q", string(data))
}
return prettyJSON.String()
}

// prettyPrint returns a properly formatted string representation of a struct
func prettyPrint(v interface{}) string {
b, err := json.MarshalIndent(v, "", " ")
Expand Down Expand Up @@ -61,7 +47,7 @@ func TestValidateAddressFailure(t *testing.T) {

res, _, err := Instantiate(cache, checksum, env, info, msg, &igasMeter, store, api, &querier, TESTING_GAS_LIMIT, TESTING_PRINT_DEBUG)

//DEBUG: print all calls with proper formatting and deserialization
// DEBUG: print all calls with proper formatting and deserialization
fmt.Printf("\n=== Debug Information ===\n")
fmt.Printf("Cache: %#v\n", cache)
fmt.Printf("Checksum: %x\n", checksum)
Expand Down

0 comments on commit b7e048a

Please sign in to comment.