cdt/cdt_6_0_x/org.eclipse.cdt.ui.tests/resources/refactoring/ExtractMethodHistory.rts
changeset 51 49c226a8748e
parent 50 fcb77f9783d2
child 52 42077b7eab6e
equal deleted inserted replaced
50:fcb77f9783d2 51:49c226a8748e
     1 //!ExtractFunctionHistoryRefactoringTest variable defined in scope
       
     2 //#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
       
     3 //@A.h
       
     4 #ifndef A_H_
       
     5 #define A_H_
       
     6 
       
     7 class A
       
     8 {
       
     9 public:
       
    10 	A();
       
    11 	virtual ~A();
       
    12 	int foo();
       
    13 	
       
    14 private:
       
    15 	int help();
       
    16 };
       
    17 
       
    18 #endif /*A_H_*/
       
    19 
       
    20 //=
       
    21 #ifndef A_H_
       
    22 #define A_H_
       
    23 
       
    24 class A
       
    25 {
       
    26 public:
       
    27 	A();
       
    28 	virtual ~A();
       
    29 	int foo();
       
    30 	
       
    31 private:
       
    32 	int help();
       
    33     int exp();
       
    34 };
       
    35 
       
    36 #endif /*A_H_*/
       
    37 
       
    38 //@A.cpp
       
    39 #include "A.h"
       
    40 
       
    41 A::A()
       
    42 {
       
    43 }
       
    44 
       
    45 A::~A()
       
    46 {
       
    47 }
       
    48 int A::foo()
       
    49 {
       
    50 	int i = 2;
       
    51 	++i;
       
    52 	help();
       
    53 	return i;
       
    54 }
       
    55 
       
    56 int A::help()
       
    57 {
       
    58 	return 42;
       
    59 }	
       
    60 
       
    61 //=
       
    62 #include "A.h"
       
    63 
       
    64 A::A()
       
    65 {
       
    66 }
       
    67 
       
    68 A::~A()
       
    69 {
       
    70 }
       
    71 int A::exp()
       
    72 {
       
    73     int i = 2;
       
    74     ++i;
       
    75     help();
       
    76     return i;
       
    77 }
       
    78 
       
    79 int A::foo()
       
    80 {
       
    81 	int i = exp();
       
    82 	return i;
       
    83 }
       
    84 
       
    85 int A::help()
       
    86 {
       
    87 	return 42;
       
    88 }	
       
    89 
       
    90 //@refScript.xml
       
    91 <?xml version="1.0" encoding="UTF-8"?>
       
    92 <session version="1.0">
       
    93 <refactoring comment="Create method exp" description="Extract Method Refactoring" 
       
    94   fileName="file:$$projectPath$$/A.cpp" 
       
    95   flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring" 
       
    96   name="exp" project="RegressionTestProject" selection="56,25" visibility="private"/>
       
    97 </session>
       
    98 
       
    99 
       
   100 //!ExtractFunctionHistoryRefactoringTest
       
   101 //#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
       
   102 //@A.h
       
   103 #ifndef A_H_
       
   104 #define A_H_
       
   105 
       
   106 class A
       
   107 {
       
   108 public:
       
   109 	A();
       
   110 	virtual ~A();
       
   111 	int foo();
       
   112 	
       
   113 private:
       
   114 	int help();
       
   115 };
       
   116 
       
   117 #endif /*A_H_*/
       
   118 
       
   119 //=
       
   120 #ifndef A_H_
       
   121 #define A_H_
       
   122 
       
   123 class A
       
   124 {
       
   125 public:
       
   126 	A();
       
   127 	virtual ~A();
       
   128 	int foo();
       
   129 	
       
   130 private:
       
   131 	int help();
       
   132     void exp(int & i);
       
   133 };
       
   134 
       
   135 #endif /*A_H_*/
       
   136 
       
   137 //@A.cpp
       
   138 #include "A.h"
       
   139 
       
   140 A::A()
       
   141 {
       
   142 }
       
   143 
       
   144 A::~A()
       
   145 {
       
   146 }
       
   147 int A::foo()
       
   148 {
       
   149 	int i = 2;
       
   150 	//comment
       
   151 	++i;
       
   152 	help();
       
   153 	return i;
       
   154 }
       
   155 
       
   156 int A::help()
       
   157 {
       
   158 	return 42;
       
   159 }	
       
   160 
       
   161 //=
       
   162 #include "A.h"
       
   163 
       
   164 A::A()
       
   165 {
       
   166 }
       
   167 
       
   168 A::~A()
       
   169 {
       
   170 }
       
   171 void A::exp(int & i)
       
   172 {
       
   173     //comment
       
   174     ++i;
       
   175     help();
       
   176 }
       
   177 
       
   178 int A::foo()
       
   179 {
       
   180 	int i = 2;
       
   181     exp(i);
       
   182 	return i;
       
   183 }
       
   184 
       
   185 int A::help()
       
   186 {
       
   187 	return 42;
       
   188 }	
       
   189 
       
   190 //@refScript.xml
       
   191 <?xml version="1.0" encoding="UTF-8"?>
       
   192 <session version="1.0">
       
   193 <refactoring comment="Create method exp" description="Extract Method Refactoring"
       
   194  fileName="file:$$projectPath$$/A.cpp"
       
   195   flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
       
   196   name="exp" project="RegressionTestProject" selection="79,13" visibility="private"/>
       
   197 </session>
       
   198 
       
   199 //!Extract Function History first extracted statement with leading comment
       
   200 //#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
       
   201 //@main.cpp
       
   202 int main(){
       
   203 	
       
   204 	int i;
       
   205 	// Comment
       
   206 	i= 7;
       
   207 	return i;
       
   208 }
       
   209 
       
   210 //=
       
   211 void exp(int & i)
       
   212 {
       
   213     // Comment
       
   214     i = 7;
       
   215 }
       
   216 
       
   217 int main(){
       
   218 	
       
   219 	int i;
       
   220     exp(i);
       
   221 	return i;
       
   222 }
       
   223 
       
   224 //@refScript.xml
       
   225 <?xml version="1.0" encoding="UTF-8"?>
       
   226 <session version="1.0">
       
   227 <refactoring comment="Create method exp" description="Extract Method Refactoring"
       
   228  fileName="file:$$projectPath$$/main.cpp"
       
   229  flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
       
   230  name="exp" project="RegressionTestProject" selection="35,5" visibility="private"/>
       
   231 </session>
       
   232 
       
   233 //!Extract Function History extracted statement with trailling comment
       
   234 //#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
       
   235 //@main.cpp
       
   236 int main(){
       
   237 	
       
   238 	int i;
       
   239 	i= 7; // Comment
       
   240 	return i;
       
   241 }
       
   242 
       
   243 //=
       
   244 void exp(int & i)
       
   245 {
       
   246     i = 7; // Comment
       
   247 }
       
   248 
       
   249 int main(){
       
   250 	
       
   251 	int i;
       
   252     exp(i);
       
   253     return i;
       
   254 }
       
   255 
       
   256 //@refScript.xml
       
   257 <?xml version="1.0" encoding="UTF-8"?>
       
   258 <session version="1.0">
       
   259 <refactoring comment="Create method exp" description="Extract Method Refactoring"
       
   260  fileName="file:$$projectPath$$/main.cpp"
       
   261  flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
       
   262  name="exp" project="RegressionTestProject" selection="23,5" visibility="private"/>
       
   263 </session>
       
   264 
       
   265 //!ExtractFunctionRefactoringTest duplicates with different Names History Test
       
   266 //#org.eclipse.cdt.ui.tests.refactoring.RefactoringHistoryTest
       
   267 //@A.h
       
   268 #ifndef A_H_
       
   269 #define A_H_
       
   270 
       
   271 class A
       
   272 {
       
   273 public:
       
   274 	A();
       
   275 	virtual ~A();
       
   276 	int foo();
       
   277 	
       
   278 private:
       
   279 	int help();
       
   280 };
       
   281 
       
   282 #endif /*A_H_*/
       
   283 
       
   284 //=
       
   285 #ifndef A_H_
       
   286 #define A_H_
       
   287 
       
   288 class A
       
   289 {
       
   290 public:
       
   291 	A();
       
   292 	virtual ~A();
       
   293 	int foo();
       
   294 	
       
   295 private:
       
   296 	int help();
       
   297     void exp(int & i);
       
   298 };
       
   299 
       
   300 #endif /*A_H_*/
       
   301 
       
   302 //@A.cpp
       
   303 #include "A.h"
       
   304 
       
   305 A::A()
       
   306 {
       
   307 }
       
   308 
       
   309 A::~A()
       
   310 {
       
   311 	int oo = 99;
       
   312 	++oo;
       
   313 	help();
       
   314 }int A::foo()
       
   315 {
       
   316 	int i = 2;
       
   317 	++i;
       
   318 	help();
       
   319 	return i;
       
   320 }
       
   321 
       
   322 int A::help()
       
   323 {
       
   324 	return 42;
       
   325 }	
       
   326 
       
   327 //=
       
   328 #include "A.h"
       
   329 
       
   330 A::A()
       
   331 {
       
   332 }
       
   333 
       
   334 A::~A()
       
   335 {
       
   336 	int oo = 99;
       
   337     exp(oo);
       
   338 }void A::exp(int & i)
       
   339 {
       
   340     ++i;
       
   341     help();
       
   342 }
       
   343 
       
   344 int A::foo()
       
   345 {
       
   346 	int i = 2;
       
   347     exp(i);
       
   348 	return i;
       
   349 }
       
   350 
       
   351 int A::help()
       
   352 {
       
   353 	return 42;
       
   354 }	
       
   355 
       
   356 //@refScript.xml
       
   357 <?xml version="1.0" encoding="UTF-8"?>
       
   358 <session version="1.0">
       
   359 <refactoring comment="Create method exp" description="Extract Method Refactoring" 
       
   360  fileName="file:$$projectPath$$/A.cpp" flags="4" id="org.eclipse.cdt.internal.ui.refactoring.extractfunction.ExtractFunctionRefactoring"
       
   361  name="exp" project="RegressionTestProject" replaceDuplicates="true" selection="97,13" visibility="private"/>
       
   362 </session>