HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_tools/__pycache__/test_fixcid.cpython-310.pyc
o

�i��@s|dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
ddlZe�Gdd�dej�ZdS)	zTest Tools/scripts/fixcid.py.�)�StringION)�support)�	os_helper)�skip_if_missing�
scriptsdirc@s6eZdZdd�Zdd�Zdd�Zddd	d
�dd�Zd
S)�Testc	Cs<d}d}|�||�}d}d}|�|dj||||d��dS)Nzint xx = "xx\"xx"[xx];
zint xx = 'x\'xx' + xx;
zint yy = "xx\"xx"[yy];
zint yy = 'x\'xx' + yy;
z01
< {old1}> {new1}{new1}2
< {old2}> {new2}{new2})�old1�old2�new1�new2)�
run_script�assertMultiLineEqual�format)�selfrr	�outputr
r�r�8/usr/local/lib/python3.10/test/test_tools/test_fixcid.py�test_parse_stringss
��zTest.test_parse_stringscCs |jdddd�}|�|d�dS)Nz
xx yy
*aa bb
)z-c�-z4/* xx altered */
int xx;
/* aa unaltered */
int aa;
)�	substfile�args�inputz�1
< /* xx altered */
> /* yy altered */
/* yy altered */
2
< int xx;
> int yy;
int yy;
/* aa unaltered */
4
< int aa;
> int bb;
int bb;
)rr
)rrrrr�test_alter_comments s��zTest.test_alter_commentscCs�t�tj�|�tjtj�tj�tjd�}t|d��
}|�	d�Wd�n1s+wYttj�tjd�d��
}|�	d�Wd�n1sKwYtj�t
d�}|jtjfd�}|�|d�
|��dS)	Nzfile.c�wzint xx;
zfile.pyzxx = 'unaltered'
�	fixcid.py)rz{}:
1
< int xx;
> int yy;
)�os�mkdirr�TESTFN�
addCleanup�rmtree�path�join�open�writerrr
r)rZ
c_filename�file�scriptrrrr�test_directory<s���zTest.test_directory�)rzxx yy
)rrc
Cs�tjd}t|d��
}|�|�Wd�n1swY|�tj|�dd|gt|�}tj�	t
d�}t�t
d|��yt�t
dt|���St���?}t���+z	tj|dd�Wntyt}	z
|�|	jd	�WYd}	~	nd}	~	wwWd�n1swYWd�n1s�wYWd�n1s�wYWd�|��SWd�|��S1s�wY|��S)
Nz.substrrz-s�argv�stdin�__main__)Zrun_namer)rrr"r#r�unlink�listrr r!rrZ	swap_attr�sysrZcaptured_stdoutZcaptured_stderr�runpyZrun_path�
SystemExitZassertEqual�code�getvalue)
rrrrZ
substfilenamer$r(r%r�exitrrrrMs@
����������(��zTest.run_scriptN)r')�__name__�
__module__�__qualname__rrr&rrrrrrs
r)�__doc__�iorrZos.pathr.r-�testrZtest.supportrZtest.test_toolsrrZunittestZTestCaserrrrr�<module>s