feat(fls): Java's view of the e-mail programs

The Java view now reads what FILIUS 2.14 keeps for its e-mail programs:
the server's domain, switch and bean accounts with their mailboxes, and the
accounts of /mailserver/konten.txt, which Java reads at every simulation
start and which so win over the bean list; the client's three folders and
address book, and its account from /konten.txt (no bean holds it).

javaEmail.ts ports the bean setters and both file readers
(stringZuListeBenutzerkonten, EmailKonto(String)); javaString.ts Java's
trim, split and StringTokenizer; javaFileSystem.ts the file lookup, now
shared with the DNS server, with the four non-ASCII units Java's
equalsIgnoreCase also takes for an ASCII letter (measured over the BMP).

Checked against Java on the corpus (the oracle dumps the e-mail state) and
on 43 account files read by EmailServer.kontenLaden and
EmailAnwendung.laden (EmailFileCases). Found: older files keep recipients
as strings in the typed lists; a getter copy of the sender is filled and
set back; one short server line makes Java throw for the whole file; a
message with an empty text is lost on reading; a broken last client line
empties the account.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 07:06:55 +00:00
co-authored by Claude Opus 5.5
parent c80d212c90
commit ec5523d7c7
22 changed files with 2900 additions and 94 deletions
+35
View File
@@ -0,0 +1,35 @@
// How Java FILIUS finds a file by path (Dateisystem.holeDatei), as the DNS
// server and the e-mail programs use it.
import { describe, expect, it } from 'vitest';
import type { FlsFileTree } from '../src/index.js';
import { javaFileContent } from '../src/javaFileSystem.js';
const file = (name: string, content: string | null): FlsFileTree => ({ kind: 'file', name, type: 'text', content, children: [] });
const directory = (name: string, ...children: FlsFileTree[]): FlsFileTree => ({ kind: 'directory', name, children });
describe('javaFileContent', () => {
it('finds a path ignoring case, as Java does', () => {
expect(javaFileContent(directory('root', directory('DNS', file('Hosts', 'x'))), '/dns/hosts')).toBe('x');
});
it('takes the four units Java also equals with an ASCII letter (measured on the JDK)', () => {
expect(javaFileContent(directory('root', directory('dns', file('ho\u017Fts', 'long s'))), '/dns/hosts')).toBe('long s');
expect(javaFileContent(directory('root', file('\u212Aonten.txt', 'kelvin')), '/konten.txt')).toBe('kelvin');
expect(javaFileContent(directory('root', directory('ma\u0130lserver', file('konten.txt', 'dotted'))), '/mailserver/konten.txt')).toBe('dotted');
expect(javaFileContent(directory('root', directory('ma\u0131lserver', file('konten.txt', 'dotless'))), '/mailserver/konten.txt')).toBe('dotless');
expect(javaFileContent(directory('root', file('k\u00F6nten.txt', 'umlaut')), '/konten.txt')).toBeUndefined();
});
it('takes the first match in preorder, and nothing when that is a directory', () => {
const twice = directory('root', directory('dns', file('hosts', 'first')), directory('DNS', file('hosts', 'second')));
expect(javaFileContent(twice, '/dns/hosts')).toBe('first');
expect(javaFileContent(directory('root', directory('dns', directory('hosts'), file('HOSTS', 'later'))), '/dns/hosts')).toBeUndefined();
});
it('is undefined without the file, and empty for a file without content', () => {
expect(javaFileContent(undefined, '/dns/hosts')).toBeUndefined();
expect(javaFileContent(directory('root', file('hosts', 'x')), '/dns/hosts')).toBeUndefined();
expect(javaFileContent(directory('root', directory('dns', file('hosts', null))), '/dns/hosts')).toBe('');
});
});