
    <e	                         d Z ddlmZ ddlZddlZddlZddlZddlmZ ddl	m
Z
 ddlmZmZ ddlZ e              G d dej                  ZdS )	zTest Tools/scripts/fixcid.py.    )StringION)support)	os_helper)skip_if_missing
scriptsdirc                   0    e Zd Zd Zd Zd Zd
ddddZd	S )Testc           	          d}d}|                      ||z             }d}d}|                     |d                    ||||                     d S )Nzint xx = "xx\"xx"[xx];
zint xx = 'x\'xx' + xx;
zint yy = "xx\"xx"[yy];
zint yy = 'x\'xx' + yy;
z01
< {old1}> {new1}{new1}2
< {old2}> {new2}{new2})old1old2new1new2)
run_scriptassertMultiLineEqualformat)selfr   r   outputr   r   s         2/usr/lib/python3.11/test/test_tools/test_fixcid.pytest_parse_stringszTest.test_parse_strings   sk    **--**!!& VDt$VGG		
 		
 		
 		
 		
    c                 b    |                      ddd          }|                     |d           d S )Nzxx yy
*aa bb
)z-c-z4/* xx altered */
int xx;
/* aa unaltered */
int aa;
)	substfileargsinputz1
< /* xx altered */
> /* yy altered */
/* yy altered */
2
< int xx;
> int yy;
int yy;
/* aa unaltered */
4
< int aa;
> int bb;
int bb;
)r   r   )r   r   s     r   test_alter_commentszTest.test_alter_comments    sR     ! 

 

 	!!&	
 	
 	
 	
 	
r   c                    t          j        t          j                   |                     t          j        t          j                   t           j                            t          j        d          }t          |dd          5 }|	                    d           d d d            n# 1 swxY w Y   t          t           j                            t          j        d          dd          5 }|	                    d           d d d            n# 1 swxY w Y   t           j                            t          d          }|                     t          j        f	          }|                     |d
                    |                     d S )Nzfile.cwutf-8encodingzint xx;
zfile.pyzxx = 'unaltered'
	fixcid.py)r   z{}:
1
< int xx;
> int yy;
)osmkdirr   TESTFN
addCleanuprmtreepathjoinopenwriter   r   r   r   )r   
c_filenamefilescriptr   s        r   test_directoryzTest.test_directory<   s   
!"""	()*:;;;W\\)"2H==
*cG444 	$JJ{###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$"',,y/;;S"$ $ $ 	-'+JJ+,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- j+66y'7&9::!!& !&,,		
 	
 	
 	
 	
s$   B''B+.B+,DDD )r   zxx yy
)r   r   c          	         t           j        dz   }t          |dd          5 }|                    |           d d d            n# 1 swxY w Y   |                     t           j        |           dd|gt          |          z   }t          j        	                    t          d          }t          j        t          d|          5  t          j        t          dt          |                    5  t          j                    5 }t          j                    5  	 t#          j        |d	
           n2# t&          $ r%}	|                     |	j        d           Y d }	~	nd }	~	ww xY wd d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   |                                S )Nz.substr   r   r    r"   z-sargvstdin__main__)run_namer   )r   r%   r*   r+   r&   unlinklistr#   r(   r)   r   r   	swap_attrsysr   captured_stdoutcaptured_stderrrunpyrun_path
SystemExitassertEqualcodegetvalue)
r   r   r   r   substfilenamer-   r2   r.   r   exits
             r   r   zTest.run_scriptN   s   !(83-w777 	"4JJy!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"	(-888T=1DJJ>j+66sFD11 	/ 	/!#w@@	/ 	/'))	/-3'))	/ 	//v
;;;;; / / /  A......../	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/ 	/    s   AAA)F1-FFE,	D.-E,	.
E8EE,	EE,	 F,E00F3E04F7FFF
FFF1F	F1!F	"F11F58F5N)r0   )__name__
__module____qualname__r   r   r/   r    r   r   r	   r	      sc        
 
 
"
 
 
8
 
 
$!6Y ! ! ! ! ! ! !r   r	   )__doc__ior   r#   os.pathr<   r9   testr   test.supportr   test.test_toolsr   r   unittestTestCaser	   rG   r   r   <module>rP      s    # #                



       " " " " " " 7 7 7 7 7 7 7 7     P! P! P! P! P!8 P! P! P! P! P!r   