View Issue Details

IDProjectCategoryView StatusLast Update
0034643pas2jsrtlpublic2020-09-20 01:57
Reportersilvioprog Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionreopened 
Summary0034643: [FEATURE REQUEST] $ASSERTIONS
DescriptionHi.

It would be nice to support assertions.

Thank you!
TagsNo tags attached.
Fixed in Revision40479
Attached Files

Activities

Mattias Gaertner

2018-12-04 09:30

manager   ~0112345

This exists since 0.8.45:

http://wiki.freepascal.org/Pas2JS_Version_Changes#Version_0.8.45

What is missing?

silvioprog

2018-12-04 15:42

reporter   ~0112352

It seems it doesn't work. Consider the following code:

program test_bytesstream;

{$ASSERTIONS ON}

begin
  Assert(False, 'Fail');
  WriteLn('All tests OK');
end.


It always prints "All tests OK", but it should print "Fail (project1.lpr, line 6)".

Mattias Gaertner

2018-12-04 16:21

manager   ~0112353

You are right, the boolean is reversed.

jamie philbrook

2018-12-04 23:02

reporter   ~0112363

Just tried it in 1.8.4 laz GUI app, it works fine...

I use assert in many locations and it works as expected..

Don't know what to say..

silvioprog

2018-12-07 00:11

reporter   ~0112415

Mattias, how to get this correction? I've updated my SVN copy (rev216) and the problem persists.

Mattias Gaertner

2018-12-07 01:03

manager   ~0112419

svn co https://svn.freepascal.org/svn/projects/pas2js/trunk pas2js
cd pas2js
make clean all

create a file test1.pas:
begin
  Assert(false,'false');
  Assert(true,'true');
end.

bin/x86_64-linux/pas2js @compiler/utils/pas2js/pas2js.cfg -Sa -Tnodejs -Jc test1.pas -va

nodejs test1.js
/home/mattias/pas2js/test1.js:2392
    if (!false) throw "false";

silvioprog

2018-12-07 01:25

reporter   ~0112421

Last edited: 2018-12-08 18:24

View 2 revisions

It works. Thanks for sharing the full steps. This issue is solved.

Issue History

Date Modified Username Field Change
2018-12-04 04:46 silvioprog New Issue
2018-12-04 09:28 Mattias Gaertner Assigned To => Mattias Gaertner
2018-12-04 09:28 Mattias Gaertner Status new => assigned
2018-12-04 09:30 Mattias Gaertner Note Added: 0112345
2018-12-04 09:30 Mattias Gaertner Status assigned => feedback
2018-12-04 15:42 silvioprog Note Added: 0112352
2018-12-04 15:42 silvioprog Status feedback => assigned
2018-12-04 16:21 Mattias Gaertner Note Added: 0112353
2018-12-04 16:21 Mattias Gaertner Status assigned => confirmed
2018-12-04 23:02 jamie philbrook Note Added: 0112363
2018-12-06 15:31 Mattias Gaertner Fixed in Revision => 40479
2018-12-06 15:31 Mattias Gaertner Status confirmed => resolved
2018-12-06 15:31 Mattias Gaertner Resolution open => fixed
2018-12-07 00:11 silvioprog Note Added: 0112415
2018-12-07 00:11 silvioprog Status resolved => feedback
2018-12-07 00:11 silvioprog Resolution fixed => reopened
2018-12-07 01:03 Mattias Gaertner Note Added: 0112419
2018-12-07 01:25 silvioprog Note Added: 0112421
2018-12-07 01:25 silvioprog Status feedback => assigned
2018-12-08 18:24 silvioprog Note Edited: 0112421 View Revisions
2020-09-20 01:57 Mattias Gaertner Status assigned => resolved