mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 08:29:29 +02:00
pastojs: test raise functioncall
git-svn-id: trunk@37433 -
This commit is contained in:
parent
40b359c1ba
commit
061c0b4da3
@ -8289,18 +8289,23 @@ end;
|
||||
procedure TTestModule.TestClass_RaiseDescendant;
|
||||
begin
|
||||
StartProgram(false);
|
||||
Add('type');
|
||||
Add(' TObject = class');
|
||||
Add(' constructor Create(Msg: string);');
|
||||
Add(' end;');
|
||||
Add(' Exception = class');
|
||||
Add(' end;');
|
||||
Add(' EConvertError = class(Exception)');
|
||||
Add(' end;');
|
||||
Add('constructor TObject.Create(Msg: string); begin end;');
|
||||
Add('begin');
|
||||
Add(' raise Exception.Create(''Bar1'');');
|
||||
Add(' raise EConvertError.Create(''Bar2'');');
|
||||
Add([
|
||||
'type',
|
||||
' TObject = class',
|
||||
' constructor Create(Msg: string);',
|
||||
' end;',
|
||||
' Exception = class',
|
||||
' end;',
|
||||
' EConvertError = class(Exception)',
|
||||
' end;',
|
||||
'constructor TObject.Create(Msg: string); begin end;',
|
||||
'function AssertConv(Msg: string = ''def''): EConvertError; begin end;',
|
||||
'begin',
|
||||
' raise Exception.Create(''Bar1'');',
|
||||
' raise EConvertError.Create(''Bar2'');',
|
||||
' raise AssertConv(''Bar2'');',
|
||||
' raise AssertConv;',
|
||||
'']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestClass_RaiseDescendant',
|
||||
LinesToStr([ // statements
|
||||
@ -8316,10 +8321,16 @@ begin
|
||||
'});',
|
||||
'rtl.createClass($mod, "EConvertError", $mod.Exception, function () {',
|
||||
'});',
|
||||
'this.AssertConv = function (Msg) {',
|
||||
' var Result = null;',
|
||||
' return Result;',
|
||||
'};',
|
||||
'']),
|
||||
LinesToStr([ // $mod.$main
|
||||
'throw $mod.Exception.$create("Create",["Bar1"]);',
|
||||
'throw $mod.EConvertError.$create("Create",["Bar2"]);',
|
||||
'throw $mod.AssertConv("Bar2");',
|
||||
'throw $mod.AssertConv("def");',
|
||||
'']));
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user