tconstparser.pas 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679
  1. unit tconstparser;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, fpcunit, pastree, pscanner, tcbaseparser, testregistry, pparser;
  6. Type
  7. { TTestConstParser }
  8. TTestConstParser = Class(TTestParser)
  9. private
  10. FConst: TPasConst;
  11. FExpr: TPasExpr;
  12. FHint : string;
  13. FTyped: String;
  14. procedure DoParseConstUnTypedRange;
  15. Protected
  16. Function ParseConst(ASource : String) : TPasConst;
  17. Procedure CheckExprNameKindClass(AKind : TPasExprKind; AClass : TClass);
  18. Property TheConst : TPasConst Read FConst;
  19. Property TheExpr : TPasExpr Read FExpr;
  20. Property Hint : string Read FHint Write FHint;
  21. Property Typed : String Read FTyped Write FTyped;
  22. procedure SetUp; override;
  23. Public
  24. Procedure DoTestSimpleIntConst;
  25. Procedure DoTestSimpleFloatConst;
  26. Procedure DoTestSimpleStringConst;
  27. Procedure DoTestSimpleNilConst;
  28. Procedure DoTestSimpleBoolConst;
  29. Procedure DoTestSimpleIdentifierConst;
  30. Procedure DoTestSimpleSetConst;
  31. Procedure DoTestSimpleExprConst;
  32. Published
  33. Procedure TestSimpleIntConst;
  34. Procedure TestSimpleFloatConst;
  35. Procedure TestSimpleStringConst;
  36. Procedure TestSimpleNilConst;
  37. Procedure TestSimpleBoolConst;
  38. Procedure TestSimpleIdentifierConst;
  39. Procedure TestSimpleSetConst;
  40. Procedure TestSimpleExprConst;
  41. Procedure TestSimpleIntConstDeprecatedMsg;
  42. Procedure TestSimpleIntConstDeprecated;
  43. Procedure TestSimpleFloatConstDeprecated;
  44. Procedure TestSimpleStringConstDeprecated;
  45. Procedure TestSimpleNilConstDeprecated;
  46. Procedure TestSimpleBoolConstDeprecated;
  47. Procedure TestSimpleIdentifierConstDeprecated;
  48. Procedure TestSimpleSetConstDeprecated;
  49. Procedure TestSimpleExprConstDeprecated;
  50. Procedure TestSimpleIntConstPlatform;
  51. Procedure TestSimpleFloatConstPlatform;
  52. Procedure TestSimpleStringConstPlatform;
  53. Procedure TestSimpleNilConstPlatform;
  54. Procedure TestSimpleBoolConstPlatform;
  55. Procedure TestSimpleIdentifierConstPlatform;
  56. Procedure TestSimpleSetConstPlatform;
  57. Procedure TestSimpleExprConstPlatform;
  58. Procedure TestSimpleIntConstExperimental;
  59. Procedure TestSimpleFloatConstExperimental;
  60. Procedure TestSimpleStringConstExperimental;
  61. Procedure TestSimpleNilConstExperimental;
  62. Procedure TestSimpleBoolConstExperimental;
  63. Procedure TestSimpleIdentifierConstExperimental;
  64. Procedure TestSimpleSetConstExperimental;
  65. Procedure TestSimpleExprConstExperimental;
  66. Procedure TestTypedIntConst;
  67. Procedure TestTypedFloatConst;
  68. Procedure TestTypedStringConst;
  69. Procedure TestTypedNilConst;
  70. Procedure TestTypedBoolConst;
  71. Procedure TestTypedIdentifierConst;
  72. Procedure TestTypedSetConst;
  73. Procedure TestTypedExprConst;
  74. Procedure TestRecordConst;
  75. Procedure TestArrayConst;
  76. Procedure TestRangeConst;
  77. Procedure TestRangeConstUnTyped;
  78. Procedure TestArrayOfRangeConst;
  79. end;
  80. { TTestResourcestringParser }
  81. TTestResourcestringParser = Class(TTestParser)
  82. private
  83. FExpr: TPasExpr;
  84. FHint : string;
  85. FTheStr: TPasResString;
  86. Protected
  87. Function ParseResourcestring(ASource : String) : TPasResString;
  88. Procedure CheckExprNameKindClass(AKind : TPasExprKind; AClass : TClass);
  89. Property Hint : string Read FHint Write FHint;
  90. Property TheStr : TPasResString Read FTheStr;
  91. Property TheExpr : TPasExpr Read FExpr;
  92. Public
  93. Procedure DoTestSimple;
  94. Procedure DoTestSum;
  95. Procedure DoTestSum2;
  96. Published
  97. Procedure TestSimple;
  98. Procedure TestSimpleDeprecated;
  99. Procedure TestSimplePlatform;
  100. Procedure TestSum1;
  101. Procedure TestSum1Deprecated;
  102. Procedure TestSum1Platform;
  103. Procedure TestSum2;
  104. Procedure TestSum2Deprecated;
  105. Procedure TestSum2Platform;
  106. end;
  107. implementation
  108. { TTestConstParser }
  109. function TTestConstParser.ParseConst(ASource: String): TPasConst;
  110. Var
  111. D : String;
  112. begin
  113. Add('Const');
  114. D:=' A ';
  115. If (Typed<>'') then
  116. D:=D+' : '+Typed+' ';
  117. D:=D+' = '+ASource;
  118. If Hint<>'' then
  119. D:=D+' '+Hint;
  120. Add(' '+D+';');
  121. ParseDeclarations;
  122. AssertEquals('One constant definition',1,Declarations.Consts.Count);
  123. AssertEquals('First declaration is constant definition.',TPasConst,TObject(Declarations.Consts[0]).ClassType);
  124. Result:=TPasConst(Declarations.Consts[0]);
  125. AssertNotNull(Result.Expr);
  126. FExpr:=Result.Expr;
  127. FConst:=Result;
  128. Definition:=Result;
  129. end;
  130. procedure TTestConstParser.CheckExprNameKindClass(
  131. AKind: TPasExprKind; AClass : TClass);
  132. begin
  133. AssertEquals('Correct name','A',TheConst.Name);
  134. AssertExpression('Const', TheExpr,aKind,AClass);
  135. end;
  136. procedure TTestConstParser.SetUp;
  137. begin
  138. inherited SetUp;
  139. Hint:='';
  140. end;
  141. procedure TTestConstParser.DoTestSimpleIntConst;
  142. begin
  143. ParseConst('1');
  144. AssertExpression('Integer Const',TheExpr,pekNumber,'1');
  145. end;
  146. procedure TTestConstParser.DoTestSimpleFloatConst;
  147. begin
  148. ParseConst('1.2');
  149. AssertExpression('Float const', TheExpr,pekNumber,'1.2');
  150. end;
  151. procedure TTestConstParser.DoTestSimpleStringConst;
  152. begin
  153. ParseConst('''test''');
  154. AssertExpression('String const', TheExpr,pekString,'''test''');
  155. end;
  156. procedure TTestConstParser.DoTestSimpleNilConst;
  157. begin
  158. ParseConst('Nil');
  159. CheckExprNameKindClass(pekNil,TNilExpr);
  160. end;
  161. procedure TTestConstParser.DoTestSimpleBoolConst;
  162. begin
  163. ParseConst('True');
  164. CheckExprNameKindClass(pekBoolConst,TBoolconstExpr);
  165. AssertEquals('Correct expression value',True,TBoolconstExpr(TheExpr).Value);
  166. end;
  167. procedure TTestConstParser.DoTestSimpleIdentifierConst;
  168. begin
  169. ParseConst('taCenter');
  170. AssertExpression('Enumeration const', theExpr,pekIdent,'taCenter');
  171. end;
  172. procedure TTestConstParser.DoTestSimpleSetConst;
  173. begin
  174. ParseConst('[taLeftJustify,taRightJustify]');
  175. CheckExprNameKindClass(pekSet,TParamsExpr);
  176. AssertEquals('Correct set count',2,Length(TParamsExpr(TheExpr).Params));
  177. AssertExpression('Set element 1',TParamsExpr(TheExpr).Params[0],pekIdent,'taLeftJustify');
  178. AssertExpression('Set element 2',TParamsExpr(TheExpr).Params[1],pekIdent,'taRightJustify');
  179. end;
  180. procedure TTestConstParser.DoTestSimpleExprConst;
  181. Var
  182. B : TBinaryExpr;
  183. begin
  184. ParseConst('1 + 2');
  185. CheckExprNameKindClass(pekBinary,TBinaryExpr);
  186. B:=TBinaryExpr(TheExpr);
  187. TAssert.AssertSame('B.Left.Parent=B',B,B.left.Parent);
  188. TAssert.AssertSame('B.right.Parent=B',B,B.right.Parent);
  189. AssertExpression('Left expression',B.Left,pekNumber,'1');
  190. AssertExpression('Right expression',B.Right,pekNumber,'2');
  191. end;
  192. procedure TTestConstParser.TestSimpleIntConst;
  193. begin
  194. DoTestSimpleIntConst
  195. end;
  196. procedure TTestConstParser.TestSimpleFloatConst;
  197. begin
  198. DoTestSimpleFloatConst
  199. end;
  200. procedure TTestConstParser.TestSimpleStringConst;
  201. begin
  202. DoTestSimpleStringConst
  203. end;
  204. procedure TTestConstParser.TestSimpleNilConst;
  205. begin
  206. DoTestSimpleNilConst
  207. end;
  208. procedure TTestConstParser.TestSimpleBoolConst;
  209. begin
  210. DoTestSimpleBoolConst
  211. end;
  212. procedure TTestConstParser.TestSimpleIdentifierConst;
  213. begin
  214. DoTestSimpleIdentifierConst
  215. end;
  216. procedure TTestConstParser.TestSimpleSetConst;
  217. begin
  218. DoTestSimpleSetConst
  219. end;
  220. procedure TTestConstParser.TestSimpleExprConst;
  221. begin
  222. DoTestSimpleExprConst;
  223. end;
  224. procedure TTestConstParser.TestSimpleIntConstDeprecatedMsg;
  225. begin
  226. Hint:='deprecated ''this is old''' ;
  227. DoTestSimpleIntConst;
  228. CheckHint(hDeprecated);
  229. end;
  230. procedure TTestConstParser.TestSimpleIntConstDeprecated;
  231. begin
  232. Hint:='deprecated';
  233. DoTestSimpleIntConst;
  234. CheckHint(hDeprecated);
  235. end;
  236. procedure TTestConstParser.TestSimpleFloatConstDeprecated;
  237. begin
  238. Hint:='deprecated';
  239. DoTestSimpleIntConst;
  240. CheckHint(hDeprecated);
  241. end;
  242. procedure TTestConstParser.TestSimpleStringConstDeprecated;
  243. begin
  244. Hint:='deprecated';
  245. DoTestSimpleStringConst;
  246. CheckHint(hDeprecated);
  247. end;
  248. procedure TTestConstParser.TestSimpleNilConstDeprecated;
  249. begin
  250. Hint:='deprecated';
  251. DoTestSimpleNilConst;
  252. CheckHint(hDeprecated);
  253. end;
  254. procedure TTestConstParser.TestSimpleBoolConstDeprecated;
  255. begin
  256. Hint:='deprecated';
  257. DoTestSimpleBoolConst;
  258. CheckHint(hDeprecated);
  259. end;
  260. procedure TTestConstParser.TestSimpleIdentifierConstDeprecated;
  261. begin
  262. Hint:='deprecated';
  263. DoTestSimpleIdentifierConst;
  264. CheckHint(hDeprecated);
  265. end;
  266. procedure TTestConstParser.TestSimpleSetConstDeprecated;
  267. begin
  268. Hint:='deprecated';
  269. DoTestSimpleSetConst;
  270. CheckHint(hDeprecated);
  271. end;
  272. procedure TTestConstParser.TestSimpleExprConstDeprecated;
  273. begin
  274. Hint:='deprecated';
  275. DoTestSimpleExprConst;
  276. CheckHint(hDeprecated);
  277. end;
  278. procedure TTestConstParser.TestSimpleIntConstPlatform;
  279. begin
  280. Hint:='Platform';
  281. DoTestSimpleIntConst;
  282. CheckHint(hPlatform);
  283. end;
  284. procedure TTestConstParser.TestSimpleFloatConstPlatform;
  285. begin
  286. Hint:='Platform';
  287. DoTestSimpleIntConst;
  288. CheckHint(hPlatform);
  289. end;
  290. procedure TTestConstParser.TestSimpleStringConstPlatform;
  291. begin
  292. Hint:='Platform';
  293. DoTestSimpleStringConst;
  294. CheckHint(hPlatform);
  295. end;
  296. procedure TTestConstParser.TestSimpleNilConstPlatform;
  297. begin
  298. Hint:='Platform';
  299. DoTestSimpleNilConst;
  300. CheckHint(hPlatform);
  301. end;
  302. procedure TTestConstParser.TestSimpleBoolConstPlatform;
  303. begin
  304. Hint:='Platform';
  305. DoTestSimpleBoolConst;
  306. CheckHint(hPlatform);
  307. end;
  308. procedure TTestConstParser.TestSimpleIdentifierConstPlatform;
  309. begin
  310. Hint:='Platform';
  311. DoTestSimpleIdentifierConst;
  312. CheckHint(hPlatform);
  313. end;
  314. procedure TTestConstParser.TestSimpleExprConstPlatform;
  315. begin
  316. Hint:='Platform';
  317. DoTestSimpleExprConst;
  318. CheckHint(hPlatform);
  319. end;
  320. procedure TTestConstParser.TestSimpleSetConstPlatform;
  321. begin
  322. Hint:='Platform';
  323. DoTestSimpleSetConst;
  324. CheckHint(hPlatform);
  325. end;
  326. procedure TTestConstParser.TestSimpleIntConstExperimental;
  327. begin
  328. Hint:='Experimental';
  329. DoTestSimpleIntConst;
  330. CheckHint(hExperimental);
  331. end;
  332. procedure TTestConstParser.TestSimpleFloatConstExperimental;
  333. begin
  334. Hint:='Experimental';
  335. DoTestSimpleIntConst;
  336. CheckHint(hExperimental);
  337. end;
  338. procedure TTestConstParser.TestSimpleStringConstExperimental;
  339. begin
  340. Hint:='Experimental';
  341. DoTestSimpleStringConst;
  342. CheckHint(hExperimental);
  343. end;
  344. procedure TTestConstParser.TestSimpleNilConstExperimental;
  345. begin
  346. Hint:='Experimental';
  347. DoTestSimpleNilConst;
  348. CheckHint(hExperimental);
  349. end;
  350. procedure TTestConstParser.TestSimpleBoolConstExperimental;
  351. begin
  352. Hint:='Experimental';
  353. DoTestSimpleBoolConst;
  354. CheckHint(hExperimental);
  355. end;
  356. procedure TTestConstParser.TestSimpleIdentifierConstExperimental;
  357. begin
  358. Hint:='Experimental';
  359. DoTestSimpleIdentifierConst;
  360. CheckHint(hExperimental);
  361. end;
  362. procedure TTestConstParser.TestSimpleSetConstExperimental;
  363. begin
  364. Hint:='Experimental';
  365. DoTestSimpleSetConst;
  366. CheckHint(hExperimental);
  367. end;
  368. procedure TTestConstParser.TestSimpleExprConstExperimental;
  369. begin
  370. Hint:='Experimental';
  371. DoTestSimpleExprConst;
  372. CheckHint(hExperimental);
  373. end;
  374. procedure TTestConstParser.TestTypedIntConst;
  375. begin
  376. Typed:='Integer';
  377. DoTestSimpleIntConst
  378. end;
  379. procedure TTestConstParser.TestTypedFloatConst;
  380. begin
  381. Typed:='Double';
  382. DoTestSimpleFloatConst
  383. end;
  384. procedure TTestConstParser.TestTypedStringConst;
  385. begin
  386. Typed:='shortstring';
  387. DoTestSimpleStringConst
  388. end;
  389. procedure TTestConstParser.TestTypedNilConst;
  390. begin
  391. Typed:='PChar';
  392. DoTestSimpleNilConst
  393. end;
  394. procedure TTestConstParser.TestTypedBoolConst;
  395. begin
  396. Typed:='Boolean';
  397. DoTestSimpleBoolConst
  398. end;
  399. procedure TTestConstParser.TestTypedIdentifierConst;
  400. begin
  401. Typed:='TAlign';
  402. DoTestSimpleIdentifierConst
  403. end;
  404. procedure TTestConstParser.TestTypedSetConst;
  405. begin
  406. Typed:='TAligns';
  407. DoTestSimpleSetConst
  408. end;
  409. procedure TTestConstParser.TestTypedExprConst;
  410. begin
  411. Typed:='ShortInt';
  412. DoTestSimpleExprConst;
  413. end;
  414. procedure TTestConstParser.TestRecordConst;
  415. Var
  416. R : TRecordValues;
  417. Fi : TRecordValuesItem;
  418. begin
  419. Typed := 'TPoint';
  420. ParseConst('(x:1;y: 2)');
  421. AssertEquals('Record Values',TRecordValues,TheExpr.ClassType);
  422. R:=TheExpr as TRecordValues;
  423. AssertEquals('Expression list of ',pekListOfExp,TheExpr.Kind);
  424. AssertEquals('2 elements',2,Length(R.Fields));
  425. FI:=R.Fields[0];
  426. AssertEquals('Name field 1','x',Fi.Name);
  427. AssertExpression('Field 1 value',Fi.ValueExp,pekNumber,'1');
  428. FI:=R.Fields[1];
  429. AssertEquals('Name field 2','y',Fi.Name);
  430. AssertExpression('Field 2 value',Fi.ValueExp,pekNumber,'2');
  431. end;
  432. procedure TTestConstParser.TestArrayConst;
  433. Var
  434. R : TArrayValues;
  435. begin
  436. Typed := 'TMyArray';
  437. ParseConst('(1 , 2)');
  438. AssertEquals('Array Values',TArrayValues,TheExpr.ClassType);
  439. R:=TheExpr as TArrayValues;
  440. AssertEquals('Expression list of ',pekListOfExp,TheExpr.Kind);
  441. AssertEquals('2 elements',2,Length(R.Values));
  442. AssertExpression('Element 1 value',R.Values[0],pekNumber,'1');
  443. AssertExpression('Element 2 value',R.Values[1],pekNumber,'2');
  444. end;
  445. procedure TTestConstParser.TestRangeConst;
  446. begin
  447. Typed:='0..1';
  448. ParseConst('1');
  449. AssertEquals('Range type',TPasRangeType,TheConst.VarType.ClassType);
  450. AssertExpression('Float const', TheExpr,pekNumber,'1');
  451. end;
  452. procedure TTestConstParser.DoParseConstUnTypedRange;
  453. begin
  454. ParseConst('1..2');
  455. end;
  456. procedure TTestConstParser.TestRangeConstUnTyped;
  457. begin
  458. AssertException('Range const is not allowed',EParserError,@DoParseConstUnTypedRange);
  459. end;
  460. procedure TTestConstParser.TestArrayOfRangeConst;
  461. Var
  462. R : TArrayValues;
  463. begin
  464. Typed:='array [0..7] of 0..1';
  465. ParseConst('(0, 0, 0, 0, 0, 0, 0, 0)');
  466. AssertEquals('Array Values',TArrayValues,TheExpr.ClassType);
  467. R:=TheExpr as TArrayValues;
  468. AssertEquals('Expression list of ',pekListOfExp,TheExpr.Kind);
  469. AssertEquals('elements',8,Length(R.Values));
  470. // AssertEquals('Range type',TPasRangeType,TheConst.VarType.ClassType);
  471. // AssertExpression('Float const', TheExpr,pekNumber,'1');
  472. end;
  473. { TTestResourcestringParser }
  474. function TTestResourcestringParser.ParseResourcestring(ASource: String
  475. ): TPasResString;
  476. Var
  477. D : String;
  478. begin
  479. Add('Resourcestring');
  480. D:=' A = '+ASource;
  481. If Hint<>'' then
  482. D:=D+' '+Hint;
  483. Add(' '+D+';');
  484. Add('end.');
  485. //Writeln(source.text);
  486. ParseDeclarations;
  487. AssertEquals('One resourcestring definition',1,Declarations.ResStrings.Count);
  488. AssertEquals('First declaration is constant definition.',TPasResString,TObject(Declarations.ResStrings[0]).ClassType);
  489. Result:=TPasResString(Declarations.ResStrings[0]);
  490. FTheStr:=Result;
  491. FExpr:=Result.Expr;
  492. Definition:=Result;
  493. end;
  494. procedure TTestResourcestringParser.CheckExprNameKindClass(AKind: TPasExprKind;
  495. AClass: TClass);
  496. begin
  497. AssertEquals('Correct name','A',TheStr.Name);
  498. AssertEquals('Correct expression kind',aKind,TheExpr.Kind);
  499. AssertEquals('Correct expression class',AClass,TheExpr.ClassType);
  500. // Writeln('Delcaration : ',TheStr.GetDeclaration(True));
  501. end;
  502. procedure TTestResourcestringParser.DoTestSimple;
  503. begin
  504. ParseResourcestring('''Something''');
  505. CheckExprNameKindClass(pekString,TPrimitiveExpr);
  506. AssertEquals('Correct expression value','''Something''',TPrimitiveExpr(TheExpr).Value);
  507. end;
  508. procedure TTestResourcestringParser.DoTestSum;
  509. var
  510. B: TBinaryExpr;
  511. begin
  512. ParseResourcestring('''Something''+'' else''');
  513. CheckExprNameKindClass(pekBinary,TBinaryExpr);
  514. B:=TBinaryExpr(TheExpr);
  515. TAssert.AssertSame('B.left.parent=B',B,B.left.Parent);
  516. TAssert.AssertSame('B.right.parent=B',B,B.right.Parent);
  517. AssertEquals('Correct left',TPrimitiveExpr,B.Left.ClassType);
  518. AssertEquals('Correct right',TPrimitiveExpr,B.Right.ClassType);
  519. AssertEquals('Correct left expression value','''Something''',TPrimitiveExpr(B.Left).Value);
  520. AssertEquals('Correct right expression value',''' else''',TPrimitiveExpr(B.Right).Value);
  521. end;
  522. procedure TTestResourcestringParser.DoTestSum2;
  523. var
  524. B: TBinaryExpr;
  525. begin
  526. ParseResourcestring('''Something''+different');
  527. CheckExprNameKindClass(pekBinary,TBinaryExpr);
  528. B:=TBinaryExpr(TheExpr);
  529. TAssert.AssertSame('B.left.parent=B',B,B.left.Parent);
  530. TAssert.AssertSame('B.right.parent=B',B,B.right.Parent);
  531. AssertEquals('Correct left',TPrimitiveExpr,B.Left.ClassType);
  532. AssertEquals('Correct right',TPrimitiveExpr,B.Right.ClassType);
  533. AssertEquals('Correct left expression value','''Something''',TPrimitiveExpr(B.Left).Value);
  534. AssertEquals('Correct right expression value','different',TPrimitiveExpr(B.Right).Value);
  535. end;
  536. procedure TTestResourcestringParser.TestSimple;
  537. begin
  538. DoTestSimple;
  539. end;
  540. procedure TTestResourcestringParser.TestSimpleDeprecated;
  541. begin
  542. Hint:='deprecated';
  543. DoTestSimple;
  544. CheckHint(hDeprecated);
  545. end;
  546. procedure TTestResourcestringParser.TestSimplePlatform;
  547. begin
  548. Hint:='platform';
  549. DoTestSimple;
  550. CheckHint(hPlatform);
  551. end;
  552. procedure TTestResourcestringParser.TestSum2;
  553. begin
  554. DoTestSum2;
  555. end;
  556. procedure TTestResourcestringParser.TestSum2Deprecated;
  557. begin
  558. Hint:='deprecated';
  559. DoTestSum2;
  560. CheckHint(hDeprecated);
  561. end;
  562. procedure TTestResourcestringParser.TestSum2Platform;
  563. begin
  564. Hint:='platform';
  565. DoTestSum2;
  566. CheckHint(hplatform);
  567. end;
  568. procedure TTestResourcestringParser.TestSum1;
  569. begin
  570. DoTestSum;
  571. end;
  572. procedure TTestResourcestringParser.TestSum1Deprecated;
  573. begin
  574. Hint:='deprecated';
  575. DoTestSum;
  576. CheckHint(hDeprecated);
  577. end;
  578. procedure TTestResourcestringParser.TestSum1Platform;
  579. begin
  580. Hint:='platform';
  581. DoTestSum;
  582. CheckHint(hplatform);
  583. end;
  584. initialization
  585. RegisterTests([TTestConstParser,TTestResourcestringParser]);
  586. end.