(test) add cases to the suite for pronoun parsing from commas

This commit is contained in:
Valentyne Stigloher 2024-01-13 13:22:11 +01:00
parent 6309daa78c
commit 067a7b4dd9
2 changed files with 42 additions and 42 deletions

View File

@ -591,7 +591,7 @@ export class Pronoun {
}
return new Pronoun(
m[MORPHEMES[0]],
`${m[MORPHEMES[0]]}/${m[MORPHEMES[1]]}`,
data[data.length - 1],
false,
m,

View File

@ -221,47 +221,47 @@ describe('when configured that slashes cannot contain morphemes', () => {
});
});
test('builds generated pronouns from commas', () => {
const actual = expect(buildPronoun(pronouns, 'ae,aer,aer,aers,aerself,0,'));
actual.toBeDefined();
actual.toEqual(new Pronoun(
'ae',
'',
false,
{
pronoun_subject: 'ae',
pronoun_object: 'aer',
possessive_determiner: 'aer',
possessive_pronoun: 'aers',
reflexive: 'aerself',
},
[false],
[false],
[],
'__generator__',
false,
));
});
test('builds generated pronouns from commas with compressed parts', () => {
const actual = expect(buildPronoun(pronouns, 'they,!2,aers,!2,'));
actual.toBeDefined();
actual.toEqual(new Pronoun(
'they',
'',
false,
{
pronoun_subject: 'they',
pronoun_object: 'them',
possessive_determiner: 'their',
possessive_pronoun: 'aers',
reflexive: 'themselves',
},
[true],
[false],
[],
'__generator__',
false,
));
describe('building generated pronouns from commas', () => {
test('succeeds with all parts present', () => {
const actual = expect(buildPronoun(pronouns, 'ae,aer,aer,aers,aerself,0,'));
actual.toBeDefined();
actual.toEqual(generatedPronouns.aer);
});
test('succeeds with description missing present', () => {
const actual = expect(buildPronoun(pronouns, 'ae,aer,aer,aers,aerself,0'));
actual.toBeDefined();
actual.toEqual(generatedPronouns.aer);
});
test('succeeds with base pronoun and some custom morphemes', () => {
const actual = expect(buildPronoun(pronouns, 'they,!2,aers,!2,'));
actual.toBeDefined();
actual.toEqual(new Pronoun(
'they/them',
'',
false,
{
pronoun_subject: 'they',
pronoun_object: 'them',
possessive_determiner: 'their',
possessive_pronoun: 'aers',
reflexive: 'themselves',
},
[true],
[false],
[],
'__generator__',
false,
));
});
test('fails when too few parts are given', () => {
expect(buildPronoun(pronouns, 'ae,aer,aer,aers,aerself')).toBeUndefined();
});
test('fails when many few parts are given', () => {
expect(buildPronoun(pronouns, 'ae,aer,aer,aers,aerself,aersing,0,')).toBeUndefined();
});
test('fails when base pronoun is unknown', () => {
expect(buildPronoun(pronouns, 's/he,!2,aers,!2,')).toBeUndefined();
});
});
describe('builds interchangable pronouns from ampersand', () => {