<commit_before><?hh //partial

namespace hhpack\getopt\spec;

use hhpack\getopt\ArgumentsExtractor;
use hhpack\getopt\ArgumentOptions;
use hhpack\getopt\FlagOption;
use hhpack\getopt\ValueOption;

describe(ArgumentsExtractor::class, function () {
  describe('items', function () {
    context('when -nfoo', function () {
      beforeEach(function () {
        $this->args = [ '-nfoo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-n');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when -n=foo', function () {
      beforeEach(function () {
        $this->args = [ '-n=foo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-n');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when --name=foo', function () {
      beforeEach(function () {
        $this->args = [ '--name=foo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('--name');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when -dv', function () {
      beforeEach(function () {
        $this->args = [ '-dV' ];
        $this->options = new ArgumentOptions([
          new FlagOption('debug', 'd', 'debug'),
          new FlagOption('verbose', 'V', 'verbose')
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-d');
        expect($this->extractor->at(1))->toBe('-V');
      });
    });
  });
});
<commit_msg>add long name spec<commit_after><?hh //partial

namespace hhpack\getopt\spec;

use hhpack\getopt\ArgumentsExtractor;
use hhpack\getopt\ArgumentOptions;
use hhpack\getopt\FlagOption;
use hhpack\getopt\ValueOption;

describe(ArgumentsExtractor::class, function () {
  describe('items', function () {
    context('when -nfoo', function () {
      beforeEach(function () {
        $this->args = [ '-nfoo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-n');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when -n=foo', function () {
      beforeEach(function () {
        $this->args = [ '-n=foo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-n');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when --name=foo', function () {
      beforeEach(function () {
        $this->args = [ '--name=foo' ];
        $this->options = new ArgumentOptions([
          new ValueOption('name', 'n', 'name', 'foo', false)
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('--name');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
    context('when -dv', function () {
      beforeEach(function () {
        $this->args = [ '-dV' ];
        $this->options = new ArgumentOptions([
          new FlagOption('debug', 'd', 'debug'),
          new FlagOption('verbose', 'V', 'verbose')
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('-d');
        expect($this->extractor->at(1))->toBe('-V');
      });
    });
    context('when --no-name', function () {
      beforeEach(function () {
        $this->args = [ '--no-name' ];
        $this->options = new ArgumentOptions([
          new FlagOption('noName', 'N', 'no-name')
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('--no-name');
      });
    });
    context('when --long-name foo', function () {
      beforeEach(function () {
        $this->args = [ '--long-name', 'foo' ];
        $this->options = new ArgumentOptions([
          new FlagOption('longName', 'N', 'long-name')
        ]);
        $this->extractor = new ArgumentsExtractor($this->options, $this->args);
      });
      it('return extract arguments', function () {
        expect($this->extractor->at(0))->toBe('--long-name');
        expect($this->extractor->at(1))->toBe('foo');
      });
    });
  });
});

{'fraction_non_alphanumeric': 0.21158645276292334, 'fraction_numerical': 0.0033868092691622105, 'mean_word_length': 2.6014120667522467, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 110, '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': '7564515', 'n_tokens_mistral': 1688, 'n_tokens_neox': 1687, 'n_words': 286}