aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-10-12 17:34:24 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-10-13 04:14:11 +0530
commitb836dc94f2ba0d9953f61ba6bcec2a4ced504beb (patch)
tree734856d87e5bf0ec4f4d5c205a7fbd26297752fc /test
parentc111cefa5de2337fc677367ee2d727b8a56e3fd0 (diff)
downloadhypervideo-pre-b836dc94f2ba0d9953f61ba6bcec2a4ced504beb.tar.lz
hypervideo-pre-b836dc94f2ba0d9953f61ba6bcec2a4ced504beb.tar.xz
hypervideo-pre-b836dc94f2ba0d9953f61ba6bcec2a4ced504beb.zip
[outtmpl] Fix bug in expanding environment variables
Diffstat (limited to 'test')
-rw-r--r--test/test_YoutubeDL.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 06963f7a8..bd2d752e2 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -817,6 +817,12 @@ class TestYoutubeDL(unittest.TestCase):
compat_setenv('__yt_dlp_var', 'expanded')
envvar = '%__yt_dlp_var%' if compat_os_name == 'nt' else '$__yt_dlp_var'
test(envvar, (envvar, 'expanded'))
+ if compat_os_name == 'nt':
+ test('%s%', ('%s%', '%s%'))
+ compat_setenv('s', 'expanded')
+ test('%s%', ('%s%', 'expanded')) # %s% should be expanded before escaping %s
+ compat_setenv('(test)s', 'expanded')
+ test('%(test)s%', ('NA%', 'expanded')) # Environment should take priority over template
# Path expansion and escaping
test('Hello %(title1)s', 'Hello $PATH')