app
AI Flow
Public Made by Adomby adom
Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board.
main
John Lauer
Guard contributions against stale bases and lost concurrent capabilities
eb60e87
import unittest
from pr_preflight import inspect
class PreflightTests(unittest.TestCase):
def test_lost_zone_module(self):
self.assertTrue(inspect('lib.rs','pub mod zone_plan;\npub mod silk_text;\n','pub mod silk_text;\n')[0])
def test_lost_verb(self):
self.assertTrue(inspect('bridge.json','{"verbs":["kicad_apply_zone_plan","kicad_silk_text_batch"]}','{"verbs":["kicad_silk_text_batch"]}')[0])
def test_lost_window_function(self):
self.assertTrue(inspect('windows.rs','fn restore_placement_one() {}\n','')[0])
def test_whole_replacement(self):
self.assertTrue(inspect('x.txt','a\n'*40,'b\n'*40)[0])
def test_addition_preserves_existing(self):
errors,diff=inspect('x.rs','pub mod zone_plan;\n','pub mod zone_plan;\npub mod silk_text;\n')
self.assertEqual(errors,[])
self.assertIn('+pub mod silk_text;',diff)
def test_scope_requires_compiler(self):
# Explicitly document the lexical check's limit: a function moved under
# cfg(test) retains its name. cargo check without cfg(test) must catch it.
self.assertEqual(inspect('x.rs','pub fn live() {}\n','#[cfg(test)] mod tests {\npub fn live() {}\n}\n')[0],[])
if __name__=='__main__': unittest.main()