<commit_before># Test if compile errors are produced where necessary.

cmake_minimum_required(VERSION 2.8)

include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/..)

function (expect_compile_error code)
  check_cxx_source_compiles("
  #include \"format.cc\"
  int main() {
    ${code}
  }
  " compiles)
  set (does_compile ${compiles})
  # Unset the CMake cache variable compiles. Otherwise the compile test will
  # just use cached information next time it runs.
  unset(compiles CACHE)
  if (does_compile)
    message(FATAL_ERROR "No compile error for: ${code}")
  endif ()
endfunction ()

# Writing a wide character to a character stream Writer is forbidden.
expect_compile_error("fmt::Writer() << L'a';")
expect_compile_error("fmt::Writer() << fmt::pad(\"abc\", 5, L' ');")
expect_compile_error("fmt::Writer() << fmt::pad(42, 5, L' ');")<commit_msg>Add tests.<commit_after># Test if compile errors are produced where necessary.

cmake_minimum_required(VERSION 2.8)

include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/..)

function (expect_compile_error code)
  check_cxx_source_compiles("
  #include \"format.cc\"
  int main() {
    ${code}
  }
  " compiles)
  set (does_compile ${compiles})
  # Unset the CMake cache variable compiles. Otherwise the compile test will
  # just use cached information next time it runs.
  unset(compiles CACHE)
  if (does_compile)
    message(FATAL_ERROR "No compile error for: ${code}")
  endif ()
endfunction ()

# Array is noncopyable.
expect_compile_error("fmt::internal::Array<char, 5> a, b(a);")
expect_compile_error("fmt::internal::Array<char, 5> a, b; b = a;")

# Writer is noncopyable.
expect_compile_error("fmt::Writer a, b(a);")
expect_compile_error("fmt::Writer a, b; b = a;")

# Writing a wide character to a character stream Writer is forbidden.
expect_compile_error("fmt::Writer() << L'a';")
expect_compile_error("fmt::Writer() << fmt::pad(\"abc\", 5, L' ');")
expect_compile_error("fmt::Writer() << fmt::pad(42, 5, L' ');")
{'fraction_non_alphanumeric': 0.14306640625, 'fraction_numerical': 0.0068359375, 'mean_word_length': 5.588424437299035, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 5, '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': '6772718', 'n_tokens_mistral': 700, 'n_tokens_neox': 681, 'n_words': 183}