<commit_before>#ifndef TEST_HELPER_HTML_H
#define TEST_HELPER_HTML_H

#include "gtest/gtest.h"

#include <cstring>

#include <gumbo.h>


namespace helper {


class Html
{
public:
  explicit Html(const char * str)
  : g_outp_(
      gumbo_parse_with_options(&kGumboDefaultOptions, str, std::strlen(str))
    )
  {
  }

  ~Html()
  {
    gumbo_destroy_output(&kGumboDefaultOptions, this->g_outp_);
  }

  const GumboNode * root() const
  {<commit_msg>check for nullptr before calling gumbo_destroy_output<commit_after>#ifndef TEST_HELPER_HTML_H
#define TEST_HELPER_HTML_H

#include "gtest/gtest.h"

#include <cstring>

#include <gumbo.h>


namespace helper {


class Html
{
public:
  explicit Html(const char * str)
  : g_outp_(
      gumbo_parse_with_options(&kGumboDefaultOptions, str, std::strlen(str))
    )
  {
  }

  ~Html()
  {
    if( this->g_outp_)
      gumbo_destroy_output(&kGumboDefaultOptions, this->g_outp_);
  }

  const GumboNode * root() const
  {
{'fraction_non_alphanumeric': 0.1142263759086189, 'fraction_numerical': 0.0, 'mean_word_length': 4.210810810810811, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 10, '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': '1062803', 'n_tokens_mistral': 395, 'n_tokens_neox': 373, 'n_words': 67}