<commit_before>#!/usr/bin/env bats

load test_helper

# `hosts enabled` #############################################################

@test "\`enabled\` with no arguments exits with status 0." {
  {
    run "$_HOSTS" add 0.0.0.0 example.com
    run "$_HOSTS" add 0.0.0.0 example.net
    run "$_HOSTS" add 127.0.0.2 example.com
    run "$_HOSTS" disable 0.0.0.0
  }

  run "$_HOSTS" enabled
  printf "\$status: %s\n" "$status"
  printf "\$output: '%s'\n" "$output"
  [[ $status -eq 0 ]]
}

@test "\`enabled\` with no arguments prints list of enabled records." {
  {
    run "$_HOSTS" add 0.0.0.0 example.com
    run "$_HOSTS" add 0.0.0.0 example.net
    run "$_HOSTS" add 127.0.0.2 example.com
    run "$_HOSTS" disable 0.0.0.0
  }

  run "$_HOSTS" enabled
  printf "\$status: %s\n" "$status"
  printf "\$output: '%s'\n" "$output"
  [[ "${lines[0]}" == "127.0.0.1	localhost" ]]
  [[ "${lines[1]}" == "255.255.255.255	broadcasthost" ]]
  [[ "${lines[2]}" == "::1             localhost" ]]
  [[ "${lines[3]}" == "fe80::1%lo0	localhost" ]]
  [[ "${lines[4]}" == "127.0.0.2	example.com" ]]
}<commit_msg>Add help tests to enabled.bats.<commit_after>#!/usr/bin/env bats

load test_helper

# `hosts enabled` #############################################################

@test "\`enabled\` with no arguments exits with status 0." {
  {
    run "$_HOSTS" add 0.0.0.0 example.com
    run "$_HOSTS" add 0.0.0.0 example.net
    run "$_HOSTS" add 127.0.0.2 example.com
    run "$_HOSTS" disable 0.0.0.0
  }

  run "$_HOSTS" enabled
  printf "\$status: %s\n" "$status"
  printf "\$output: '%s'\n" "$output"
  [[ $status -eq 0 ]]
}

@test "\`enabled\` with no arguments prints list of enabled records." {
  {
    run "$_HOSTS" add 0.0.0.0 example.com
    run "$_HOSTS" add 0.0.0.0 example.net
    run "$_HOSTS" add 127.0.0.2 example.com
    run "$_HOSTS" disable 0.0.0.0
  }

  run "$_HOSTS" enabled
  printf "\$status: %s\n" "$status"
  printf "\$output: '%s'\n" "$output"
  [[ "${lines[0]}" == "127.0.0.1	localhost" ]]
  [[ "${lines[1]}" == "255.255.255.255	broadcasthost" ]]
  [[ "${lines[2]}" == "::1             localhost" ]]
  [[ "${lines[3]}" == "fe80::1%lo0	localhost" ]]
  [[ "${lines[4]}" == "127.0.0.2	example.com" ]]
}

# help ########################################################################

@test "\`help enabled\` exits with status 0." {
  run "$_HOSTS" help enabled
  [[ $status -eq 0 ]]
}

@test "\`help enabled\` prints help information." {
  run "$_HOSTS" help enabled
  printf "\$status: %s\n" "$status"
  printf "\$output: '%s'\n" "$output"
  [[ "${lines[0]}" == "Usage:" ]]
  [[ "${lines[1]}" == "  hosts enabled" ]]
}
{'fraction_non_alphanumeric': 0.2854973424449506, 'fraction_numerical': 0.05618830675778284, 'mean_word_length': 3.2025518341307815, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 22, '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': '4965513', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1013, 'n_words': 248}