feat: scan

This commit is contained in:
hashbro
2026-09-13 02:12:06 +08:00
parent d7bd4d1b03
commit 1746e7b485
13 changed files with 266 additions and 40 deletions
+15
View File
@@ -117,6 +117,21 @@ TXT;
$this->assertSame(12, $hit['word_count']);
}
#[Test]
public function notes_keep_inline_and_glued_numbered_phrase(): void
{
$phrase = 'during exhaust tool custom smart old busy region skin wasp attitude wrist';
$spaced = '1 during 2 exhaust 3 tool 4 custom 5 smart 6 old 7 busy 8 region 9 skin 10 wasp 11 attitude 12 wrist';
$glued = '1.during 2.exhaust 3.tool 4.custom 5.smart 6.old 7.busy 8.region 9.skin 10.wasp 11.attitude 12.wrist';
foreach ([$spaced, $glued] as $text) {
$hit = (new MnemonicDetector)->detect($text, true);
$this->assertNotNull($hit);
$this->assertTrue($hit['confirmed']);
$this->assertSame($phrase, $hit['candidate']);
}
}
#[Test]
public function prefers_english_phrase_over_chinese_ui(): void
{
+12
View File
@@ -40,6 +40,18 @@ class NoteContentTest extends TestCase
$this->assertSame([], NoteContent::fromList(["\n(\n\t (\n"]));
}
#[Test]
public function keeps_full_single_line_body_when_longer_than_title(): void
{
$line = '1.during 2.exhaust 3.tool 4.custom 5.smart 6.old 7.busy 8.region 9.skin 10.wasp 11.attitude 12.wrist';
$items = NoteContent::fromList([$line]);
$this->assertCount(1, $items);
$this->assertTrue(str_starts_with($line, $items[0]['title']));
$this->assertSame($line, $items[0]['body']);
$this->assertStringContainsString('12.wrist', $items[0]['body']);
}
#[Test]
public function keeps_title_as_body_when_rest_is_notes_junk(): void
{