<commit_before>package json

import (
	"encoding/json"
	"testing"
)

func TestMarshal(t *testing.T) {

	t.Run("int64 string", func(t *testing.T) {
		in := struct {
			ID int64 `json:"id,string"`
		}{
			ID: 42,
		}

		const want = `{"id":"42"}`
		testMarshal(t, in, want)
	})

	t.Run("nil pointer int64", func(t *testing.T) {
		in := struct {
			ID *int64 `json:"id"`
		}{
			ID: nil,
		}

		const want = `{"id":null}`
		testMarshal(t, in, want)
	})

}

func testMarshal(t *testing.T, in interface{}, want string) {
	t.Helper()

	got, err := json.Marshal(&in)
	if err != nil {
		t.Fatalf("marshal: %v", err)
	}

	if string(got) != want {
		t.Errorf("got %s; want %s", got, want)
	}
}
<commit_msg>json: marshal: nil *int64<commit_after>package json

import (
	"encoding/json"
	"testing"
)

func TestMarshal(t *testing.T) {

	t.Run("int64 string", func(t *testing.T) {
		in := struct {
			ID int64 `json:"id,string"`
		}{
			ID: 42,
		}

		const want = `{"id":"42"}`
		testMarshal(t, in, want)
	})

	t.Run("nil *int64", func(t *testing.T) {
		in := struct {
			ID *int64 `json:"id"`
		}{
			ID: nil,
		}

		const want = `{"id":null}`
		testMarshal(t, in, want)
	})
}

func testMarshal(t *testing.T, in interface{}, want string) {
	t.Helper()

	got, err := json.Marshal(&in)
	if err != nil {
		t.Fatalf("marshal: %v", err)
	}

	if string(got) != want {
		t.Errorf("got %s; want %s", got, want)
	}
}

{'fraction_non_alphanumeric': 0.20630372492836677, 'fraction_numerical': 0.01862464183381089, 'mean_word_length': 3.2078313253012047, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1736667', 'n_tokens_mistral': 651, 'n_tokens_neox': 585, 'n_words': 140}