Files
WoW-Hybrid-gateway/tests/windows_codec_writer_closure_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

23 lines
1.8 KiB
Python

import unittest
from windows_codec_writer_closure import writer_projection,selected_function
class WriterProjection(unittest.TestCase):
def test_preserves_exact_writer_with_braces_strings_and_nested_scope(self):
writer='WorldPacket const* P::Write() { const char* s="{ not code }"; if (s) { return &packet; } return nullptr; }'
text='void P::Read() { /* } */ if (x) { take("{"); } }\n'+writer+'\n'
projected,names=writer_projection(text)
self.assertEqual(len(names),1);self.assertIn(writer,projected);self.assertNotIn('void P::Read',projected)
def test_removes_reader_operator_world_initializer_and_explicit_template(self):
text='ByteBuffer& operator>>(ByteBuffer& b, P& p) { return b; }\nvoid P::Initialize(Unit const* u) { use(u); }\ntemplate<class T, class U>\nbool ContentTuningParams::GenerateDataForUnits(T* a,U* b) { return true; }\ntemplate bool ContentTuningParams::GenerateDataForUnits<X,Y>(X*,Y*);\n'
projected,names=writer_projection(text)
self.assertEqual(len(names),4);self.assertFalse(projected.strip())
def test_helper_extraction_is_exact_unique_and_preserves_real_exception(self):
function='void B::OnInvalidPosition(size_t a) const\n{ throw PositionError(a); }'
text='// prefix\n'+function+'\n// suffix\n'
self.assertEqual(selected_function(text,'void B::OnInvalidPosition('),function)
with self.assertRaises(ValueError):selected_function(text+function,'void B::OnInvalidPosition(')
def test_removes_explicit_world_specialization(self):
text='template<>\nbool ContentTuningParams::GenerateDataForUnits<Creature, Player>(Creature* a, Player* b) { return live(a,b); }\n'
projected,names=writer_projection(text)
self.assertEqual(len(names),1);self.assertFalse(projected.strip())
if __name__=='__main__':unittest.main()