tconstparser.pas 17 KB

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