🐛 修复文件管理共享剪贴板模块语法
This commit is contained in:
1 parent
5db619a1e8
commit
bf68e8dded
2 files changed
+25
-22
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from scripts.patch_admin_timeline_ui import build_lifecycle_script
|
||||
from scripts.patch_admin_timeline_ui import build_lifecycle_script, patch_clipboard
|
||||
|
||||
|
||||
class AdminTimelinePatchTests(unittest.TestCase):
|
||||
@@ -11,6 +13,17 @@ class AdminTimelinePatchTests(unittest.TestCase):
|
||||
self.assertIn("展开全部取件记录", script)
|
||||
self.assertIn("row.style.overflow = 'visible'", script)
|
||||
|
||||
def test_clipboard_rewrite_keeps_module_declaration_separator(self):
|
||||
source = '''const m=async(a,e={})=>{try{return!0}catch(r){return!1}},R=async(a,e={})=>{return a};export{m};'''
|
||||
with tempfile.TemporaryDirectory() as temp_dir:
|
||||
path = Path(temp_dir) / "clipboard-test.js"
|
||||
path.write_text(source, encoding="utf-8")
|
||||
|
||||
self.assertTrue(patch_clipboard(path))
|
||||
patched = path.read_text(encoding="utf-8")
|
||||
|
||||
self.assertIn("}},R=async", patched)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user