File size: 920 Bytes
8c3e275
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# SPDX-FileCopyrightText: 2026 Team Centurions
# SPDX-License-Identifier: AGPL-3.0-or-later

from pathlib import Path

import pytest


@pytest.fixture
def grammar_text() -> str:
    path = Path(__file__).resolve().parent.parent / "grammars" / "task.gbnf"
    return path.read_text()


def test_source_page_key_quoted(grammar_text: str):
    assert '"\\"source_page\\""' in grammar_text


def test_captured_date_key_quoted(grammar_text: str):
    assert '"\\"captured_date\\""' in grammar_text


def test_tasks_key_quoted(grammar_text: str):
    assert '"\\"tasks\\""' in grammar_text


def test_task_keys_quoted(grammar_text: str):
    assert '"\\"task\\""' in grammar_text
    assert '"\\"due_date\\""' in grammar_text
    assert '"\\"priority\\""' in grammar_text


def test_grammar_parses_sample_json(grammar_text: str):
    import re

    pattern = r'"\\"source_page\\""'
    assert re.search(pattern, grammar_text)