@@ -11,6 +11,8 @@ import {
11
11
} from "../../src/interop/lionweb" ;
12
12
import { map , pipe , reduce } from "iter-ops" ;
13
13
import { STARLASU_LANGUAGE } from "../../src/interop/lionweb-starlasu-language" ;
14
+ import { ParserNode , ParserTrace } from "../../src/interop/strumenta-playground" ;
15
+ import { PARSER_TRACE_ECLASS } from "../../src/interop/parser-package" ;
14
16
15
17
abstract class File extends Node {
16
18
@Property ( )
@@ -87,6 +89,35 @@ describe('Lionweb integration', function() {
87
89
expect ( file . name ) . to . equal ( "delegate.egl" ) ;
88
90
expect ( file . contents . substring ( 0 , 10 ) ) . to . equal ( "Delegate F" ) ;
89
91
92
+ expect ( printSequence ( walk ( root . node ) ) ) . to . equal (
93
+ "resources.zip, resources, delegate.egl, rosetta-code-count-examples-2.egl, " +
94
+ "rosetta-code-count-examples-1.egl, sub1, sub2, foreach.egl, SQLDropTable.egl, for.egl, SQLBatch.egl, " +
95
+ "SQLCreateTable.egl, SQLDropTable.egl, hello.egl, foreach.egl, Calc.egl, SQLBatch.egl, " +
96
+ "multipleWhenCondition.egl, handler.egl, SQLCreateTable.egl, newExample.egl, SQLDropTable.egl, " +
97
+ "nestedLoop.egl, for.egl" ) ;
98
+ } ) ;
99
+
100
+ it ( "supports trace nodes" ,
101
+ function ( ) {
102
+ const nodes = deserializeChunk ( FS_MODEL , new TylasuInstantiationFacade ( ) , [ FS_LANGUAGE ] , [ ] ) ;
103
+ expect ( nodes ) . not . to . be . empty ;
104
+ expect ( nodes . length ) . to . equal ( 1 ) ;
105
+ const root = nodes [ 0 ] ;
106
+ expect ( root . node ) . to . be . instanceof ( LionwebNode ) ;
107
+ let dir = new ParserNode ( root . node as LionwebNode , undefined , new ParserTrace ( PARSER_TRACE_ECLASS . create ( { } ) ) ) ; // TODO
108
+ expect ( dir . nodeDefinition . name ) . to . equal ( "Directory" ) ;
109
+ expect ( dir . getAttribute ( "name" ) ) . to . equal ( "resources.zip" ) ;
110
+ expect ( dir . getChildren ( "files" ) . length ) . to . equal ( 1 ) ;
111
+ dir = dir . getChildren ( "files" ) [ 0 ] ;
112
+ expect ( dir . nodeDefinition . name ) . to . equal ( "Directory" ) ;
113
+ expect ( dir . getAttribute ( "name" ) ) . to . equal ( "resources" ) ;
114
+ expect ( dir . getChildren ( "files" ) . length ) . to . equal ( 15 ) ;
115
+ const file = dir . getChildren ( "files" ) [ 0 ] ;
116
+ expect ( file . nodeDefinition . name ) . to . equal ( "TextFile" ) ;
117
+ expect ( file . getAttribute ( "name" ) ) . to . equal ( "delegate.egl" ) ;
118
+ expect ( file . getAttribute ( "contents" ) . substring ( 0 , 10 ) ) . to . equal ( "Delegate F" ) ;
119
+ expect ( file . getPathFromRoot ( ) ) . to . equal ( [ ] ) ;
120
+
90
121
expect ( printSequence ( walk ( root . node ) ) ) . to . equal (
91
122
"resources.zip, resources, delegate.egl, rosetta-code-count-examples-2.egl, " +
92
123
"rosetta-code-count-examples-1.egl, sub1, sub2, foreach.egl, SQLDropTable.egl, for.egl, SQLBatch.egl, " +
0 commit comments