Your IP : 216.73.216.213
���]� � @ s� 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 m
Z
d d l Z e � Gd d � d e j � Z
d S)� )�StringION)�support)�skip_if_missing�
scriptsdirc @ sO e Z d Z d d � Z d d � Z d d � Z d d d d
d d d
�Z d S)�Testc C s] d } d } | j | | � } d } d } | j | d j d | d | d | d | � � d S)
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)�selfr r �outputr r
� r �0/opt/alt/python35/lib64/python3.5/test_fixcid.py�test_parse_strings s zTest.test_parse_stringsc C s2 | j d d d d d d � } | j | d � d S)
N� substfilez
xx yy
*aa bb
�args�-c�-�inputz4/* xx altered */
int xx;
/* aa unaltered */
int aa;
z�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 )r r )r r r r r �test_alter_comments s zTest.test_alter_commentsc C s� t j t j � | j t j t j � t j j t j d � } t | d � � } | j d � Wd QRXt t j j t j d � d � � } | j d � Wd QRXt j j t
d � } | j d t j f � } | j | d j
| � � d S) Nzfile.c�wzint xx;
zfile.pyzxx = 'unaltered'
z fixcid.pyr z{}:
1
< int xx;
> int yy;
)�os�mkdirr �TESTFN�
addCleanup�rmtree�path�join�open�writer r r r
)r Z
c_filename�file�scriptr r r r �test_directory; s $ zTest.test_directory� r r r zxx yy
c
3 C s: t j d } t | d � � } | j | � Wd QRX| j t j | � d d | g t | � } t j j t
d � } t j t d | � �� t j t d t
| � � �� t j � �m } t j � �W y t j | d d �Wn8 t k
r} z | j | j d � WYd d } ~ Xn XWd QRXWd QRXWd QRXWd QRX| j � S)
Nz.substr z fixcid.pyz-s�argv�stdinZrun_name�__main__r )r r r! r"