<commit_before>use v6;

use Test;
use Form;

plan 12;

ok(Form::form('a') eq "a\n", "Literal");
ok(Form::form('{<<}', 'a') eq "a   \n", "Single left-line field");
ok(Form::form('{<<}a', 'a') eq "a   a\n", "Single left-line field with literal after");
ok(Form::form('{>>}a', 'a') eq "   aa\n", "Single right-line field with literal after");
ok(Form::form('{>>><<}{<<<}', 'a', 'b') eq "   a   b    \n", "Single centred-line field with single left-line field after");
ok(Form::form('{<<}', 'a', '{>>}', 'b') eq "a   \n   b\n", "Two fields");
ok(Form::form(
    '+----+',
    '|{<<}|', 'aa',
    '+----+'
) eq "+----+\n|aa  |\n+----+\n", "Two literals, one field");
dies_ok(-> { Form::form('{<<}{>>}', 'a') }, "Insufficient arguments");
ok(Form::form('{<<<<<}', "The quick brown fox jumps over the lazy dog") eq "The    \n", "Line field overflow");
# TODO: reformat these as here-documents
ok(Form::form('{[[[[[}', "The quick brown fox jumps over the lazy dog") eq "The    \nquick  \nbrown  \nfox    \njumps  \nover   \nthe    \nlazy   \ndog    \n", "Block field overflow");
ok(
    Form::form(
        '{[[[[[[[[} {]]]]]]]]}',
        "The quick brown fox", "jumps over the lazy dog"
    )
    eq
    "The quick  jumps over\nbrown fox    the lazy\n                  dog\n",
    "Multiple block overflow"
);
ok(Form::form('{""}', "Boo\nYah") eq "Boo \nYah \n", "Literal block field");

# vim: ft=perl6 sw=4 ts=4 noexpandtab<commit_msg>[t/06-form.t] added a test for not-enough-args<commit_after>use v6;

use Test;
use Form;

plan 13;

ok(Form::form('a') eq "a\n", "Literal");
ok(Form::form('{<<}', 'a') eq "a   \n", "Single left-line field");
ok(Form::form('{<<}a', 'a') eq "a   a\n", "Single left-line field with literal after");
ok(Form::form('{>>}a', 'a') eq "   aa\n", "Single right-line field with literal after");
ok(Form::form('{>>><<}{<<<}', 'a', 'b') eq "   a   b    \n", "Single centred-line field with single left-line field after");
ok(Form::form('{<<}', 'a', '{>>}', 'b') eq "a   \n   b\n", "Two fields");
ok(Form::form(
    '+----+',
    '|{<<}|', 'aa',
    '+----+'
) eq "+----+\n|aa  |\n+----+\n", "Two literals, one field");
dies_ok(-> { Form::form('{<<}{>>}', 'a') }, "Insufficient arguments");
ok(Form::form('{<<<<<}', "The quick brown fox jumps over the lazy dog") eq "The    \n", "Line field overflow");
# TODO: reformat these as here-documents
ok(Form::form('{[[[[[}', "The quick brown fox jumps over the lazy dog") eq "The    \nquick  \nbrown  \nfox    \njumps  \nover   \nthe    \nlazy   \ndog    \n", "Block field overflow");
ok(
    Form::form(
        '{[[[[[[[[} {]]]]]]]]}',
        "The quick brown fox", "jumps over the lazy dog"
    )
    eq
    "The quick  jumps over\nbrown fox    the lazy\n                  dog\n",
    "Multiple block overflow"
);
ok(Form::form('{""}', "Boo\nYah") eq "Boo \nYah \n", "Literal block field");

dies_ok({Form::form('{<<<<}')}, 'Too few arguments');

# vim: ft=perl6 sw=4 ts=4 noexpandtab
{'fraction_non_alphanumeric': 0.2654237288135593, 'fraction_numerical': 0.0047457627118644066, 'mean_word_length': 3.2768115942028984, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 23, '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': '1716249', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1135, 'n_words': 330}