<commit_before>import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainText } from '../../SyntaxNodes/PlainText'
import { InlineQuote } from '../../SyntaxNodes/InlineQuote'
import { InlineCode } from '../../SyntaxNodes/InlineCode'


describe('Text surrounded by doublequote characters', () => {
  it('is put inside an inline quote node', () => {
    expect(Up.toDocument('Hello, "world"!!')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Hello, '),
        new InlineQuote([
          new PlainText('world')
        ]),
        new PlainText('!!')
      ]))
  })
})


describe('Inline quotes', () => {
  it('are evaluated for inline conventions', () => {
    expect(Up.toDocument('"You should always use `<font>` elements."')).to.deep.equal(
      insideDocumentAndParagraph([
        new InlineQuote([
          new PlainText('You should always use '),
          new InlineCode('<font>'),
          new PlainText(' elements.'),
        ]),
      ]))
  })

  it('can contain nested inline quotes', () => {
    expect(Up.toDocument('John stood up. "Hello, my "little" world!"')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('John stood up. '),
        new InlineQuote([
          new PlainText('Hello, my '),
          new InlineQuote([
            new PlainText('little')
          ]),
          new PlainText(' world!')
        ])
      ]))
  })
})


describe('Nested inline quotes', () => {
  it('can open at the same time', () => {
    expect(Up.toDocument('Bob recounted, ""Come here right now!", she said. But I walked away."')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Bob recounted, '),
        new InlineQuote([
          new InlineQuote([
            new PlainText('Come here right now!'),
          ]),
          new PlainText(', she said. But I walked away.')
        ])
      ]))
  })

  it('can close at the same time', () => {
    expect(Up.toDocument('"I walked away while she screamed "come here right now!"", Bob recounted.')).to.deep.equal(
      insideDocumentAndParagraph([
        new InlineQuote([
          new PlainText('I walked away while she screamed '),
          new InlineQuote([
            new PlainText('come here right now!'),
          ]),
        ]),
        new PlainText(', Bob recounted.')
      ]))
  })
})


describe('Text separated from (otherwise surrounding) doublequotes by whitespace', () => {
  it('is not put inside an inline quote node', () => {
    expect(Up.toDocument('My favorite quote mark " is your favorite quote mark " and we all know it.')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('My favorite quote mark " is your favorite quote mark " and we all know it.'),
      ]))
  })
})


context('An unmatched doublequote (that would otherwise start a quote) is preserved as plain text. This unmatched doublequote:', () => {
  specify('Can be the only doublequote in a paragraph', () => {
    expect(Up.toDocument('I said, "I am still typi')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('I said, "I am still typi'),
      ]))
  })

  specify('Can follow another unmatched double quote', () => {
    expect(Up.toDocument('Bob said, "I said, "I am still typi')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Bob said, "I said, "I am still typi'),
      ]))
  })

  specify('Can follow a proper inline quote', () => {
    expect(Up.toDocument('I said, "Hello world"! I repeat, "Hel')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('I said, '),
        new InlineQuote([
          new PlainText('Hello world')
        ]),
        new PlainText('! I repeat, "Hel')
      ]))
  })
})

<commit_msg>Add passing tests<commit_after>import { expect } from 'chai'
import Up from '../../index'
import { insideDocumentAndParagraph } from './Helpers'
import { PlainText } from '../../SyntaxNodes/PlainText'
import { InlineQuote } from '../../SyntaxNodes/InlineQuote'
import { InlineCode } from '../../SyntaxNodes/InlineCode'


describe('Text surrounded by doublequote characters', () => {
  it('is put inside an inline quote node', () => {
    expect(Up.toDocument('Hello, "world"!!')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Hello, '),
        new InlineQuote([
          new PlainText('world')
        ]),
        new PlainText('!!')
      ]))
  })
})


describe('Inline quotes', () => {
  it('are evaluated for inline conventions', () => {
    expect(Up.toDocument('"You should always use `<font>` elements."')).to.deep.equal(
      insideDocumentAndParagraph([
        new InlineQuote([
          new PlainText('You should always use '),
          new InlineCode('<font>'),
          new PlainText(' elements.'),
        ]),
      ]))
  })

  it('can contain nested inline quotes', () => {
    expect(Up.toDocument('John stood up. "Hello, my "little" world!"')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('John stood up. '),
        new InlineQuote([
          new PlainText('Hello, my '),
          new InlineQuote([
            new PlainText('little')
          ]),
          new PlainText(' world!')
        ])
      ]))
  })
})


describe('Nested inline quotes', () => {
  it('can open at the same time', () => {
    expect(Up.toDocument('Bob recounted, ""Come here right now!", she said. But I walked away."')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Bob recounted, '),
        new InlineQuote([
          new InlineQuote([
            new PlainText('Come here right now!'),
          ]),
          new PlainText(', she said. But I walked away.')
        ])
      ]))
  })

  it('can close at the same time', () => {
    expect(Up.toDocument('"I walked away while she screamed "come here right now!"", Bob recounted.')).to.deep.equal(
      insideDocumentAndParagraph([
        new InlineQuote([
          new PlainText('I walked away while she screamed '),
          new InlineQuote([
            new PlainText('come here right now!'),
          ]),
        ]),
        new PlainText(', Bob recounted.')
      ]))
  })
})


describe('Text separated from (otherwise surrounding) doublequotes by whitespace', () => {
  it('is not put inside an inline quote node', () => {
    expect(Up.toDocument('My favorite quote mark " is your favorite quote mark " and we all know it.')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('My favorite quote mark " is your favorite quote mark " and we all know it.'),
      ]))
  })
})


context('An unmatched doublequote (that would otherwise start a quote) is preserved as plain text. This unmatched doublequote:', () => {
  specify('Can be the only doublequote in a paragraph', () => {
    expect(Up.toDocument('I said, "I am still typi')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('I said, "I am still typi'),
      ]))
  })

  specify('Can follow another unmatched doublequote', () => {
    expect(Up.toDocument('Bob said, "I said, "I am still typi')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('Bob said, "I said, "I am still typi'),
      ]))
  })

  specify('Can follow a proper inline quote', () => {
    expect(Up.toDocument('I said, "Hello world"! I repeat, "Hel')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('I said, '),
        new InlineQuote([
          new PlainText('Hello world')
        ]),
        new PlainText('! I repeat, "Hel')
      ]))
  })
})


context('An unmatched doublequote (that would otherwise end a quote) is preserved as plain text. This unmatched doublequote:', () => {
  specify('Can be the only doublequote in a paragraph', () => {
    expect(Up.toDocument('My model airplane has a 30" wingspan.')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('My model airplane has a 30" wingspan.'),
      ]))
  })

  specify('Can follow another unmatched doublequote', () => {
    expect(Up.toDocument('My model airplane has a 30" wingspan and is 20" long')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('My model airplane has a 30" wingspan and is 20" long'),
      ]))
  })

  specify('Can follow a proper inline quote', () => {
    expect(Up.toDocument('I said, "Thanks!" My new model airplane has a 30" wingspan.')).to.deep.equal(
      insideDocumentAndParagraph([
        new PlainText('I said, '),
        new InlineQuote([
          new PlainText('Thanks!')
        ]),
        new PlainText(' My new model airplane has a 30" wingspan.')
      ]))
  })
})


{'fraction_non_alphanumeric': 0.15032754855763705, 'fraction_numerical': 0.0018388690955062636, 'mean_word_length': 2.679492600422833, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, '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': '7225831', 'n_tokens_mistral': 2610, 'n_tokens_neox': 2463, 'n_words': 744}