<commit_before>package org.http4s.parser

import org.scalatest.{Matchers, WordSpec}
import org.http4s.Header.`Content-Type`
import org.http4s.MediaType._
import org.http4s.CharacterSet

/**
 * @author <NAME>
 *         Created on 12/26/13
 */
class ContentTypeHeaderSpec  extends WordSpec with Matchers {

  // Also checks to make sure whitespace doesn't effect the outcome
  private def parse(value: String): `Content-Type` = {
    val a = HttpParser.CONTENT_TYPE(value).fold(err => sys.error(s"Couldn't parse: $value"), identity)
    val b = HttpParser.CONTENT_TYPE(value.replace(" ", "")).fold(err => sys.error(s"Couldn't parse: $value"), identity)
    assert(a == b, "Whitespace resulted in different Accept headers")
    a
  }

  def simple = `Content-Type`(`text/html`)
  def charset = `Content-Type`(`text/html`, CharacterSet.`UTF-8`)
  def extensions = `Content-Type`(`text/html`.withextensions(Map("foo" -> "bar")))
  def extensionsandset = `Content-Type`(`text/html`.withextensions(Map("foo" -> "bar")), CharacterSet.`UTF-8`)

  "ContentType Header" should {
    "Generate the correct values" in {
      simple.value should equal("text/html")
      charset.value should equal("text/html; charset=UTF-8")
      extensions.value should equal("text/html; foo=bar")
      extensionsandset.value should equal("text/html; foo=bar; charset=UTF-8")
    }

    "Parse correctly" in {<commit_msg>fix comment<commit_after>package org.http4s.parser

import org.scalatest.{Matchers, WordSpec}
import org.http4s.Header.`Content-Type`
import org.http4s.MediaType._
import org.http4s.CharacterSet

/**
 * @author <NAME>
 *         Created on 12/26/13
 */
class ContentTypeHeaderSpec  extends WordSpec with Matchers {

  // Also checks to make sure whitespace doesn't effect the outcome
  private def parse(value: String): `Content-Type` = {
    val a = HttpParser.CONTENT_TYPE(value).fold(err => sys.error(s"Couldn't parse: $value"), identity)
    val b = HttpParser.CONTENT_TYPE(value.replace(" ", "")).fold(err => sys.error(s"Couldn't parse: $value"), identity)
    assert(a == b, "Whitespace resulted in different Content-Type headers")
    a
  }

  def simple = `Content-Type`(`text/html`)
  def charset = `Content-Type`(`text/html`, CharacterSet.`UTF-8`)
  def extensions = `Content-Type`(`text/html`.withextensions(Map("foo" -> "bar")))
  def extensionsandset = `Content-Type`(`text/html`.withextensions(Map("foo" -> "bar")), CharacterSet.`UTF-8`)

  "ContentType Header" should {
    "Generate the correct values" in {
      simple.value should equal("text/html")
      charset.value should equal("text/html; charset=UTF-8")
      extensions.value should equal("text/html; foo=bar")
      extensionsandset.value should equal("text/html; foo=bar; charset=UTF-8")
    }

    "Parse correctly" in {
{'fraction_non_alphanumeric': 0.1505722460658083, 'fraction_numerical': 0.010014306151645207, 'mean_word_length': 4.208566108007449, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '417700', 'n_tokens_mistral': 920, 'n_tokens_neox': 887, 'n_words': 209}