@@ -6,6 +6,8 @@ import {expect} from "chai";
6
6
import { deserializeChunk , deserializeLanguages , SerializationChunk } from "@lionweb/core" ;
7
7
import { Attribute , Children , Node , TraceNode , walk } from "../../src" ;
8
8
import {
9
+ deserializeToTraceNodes ,
10
+ deserializeToTylasuNodes ,
9
11
findClassifier ,
10
12
LanguageMapping , LionwebNode ,
11
13
STARLASU_LANGUAGE_MAPPING ,
@@ -44,12 +46,12 @@ describe('Lionweb integration', function() {
44
46
45
47
it ( "can deserialize simple model" ,
46
48
function ( ) {
47
- const nodes = deserializeChunk ( FS_MODEL , new TylasuInstantiationFacade ( [ FS_LANGUAGE_MAPPING ] ) , [ FS_LANGUAGE ] , [ ] ) ;
49
+ const nodes = deserializeToTylasuNodes ( FS_MODEL , [ FS_LANGUAGE ] , [ FS_LANGUAGE_MAPPING ] ) ;
48
50
expect ( nodes ) . not . to . be . empty ;
49
51
expect ( nodes . length ) . to . equal ( 1 ) ;
50
- const root = nodes [ 0 ] as TylasuNodeWrapper ;
51
- expect ( root . node ) . to . be . instanceof ( Directory ) ;
52
- let dir = root . node as Directory ;
52
+ const root = nodes [ 0 ] ;
53
+ expect ( root ) . to . be . instanceof ( Directory ) ;
54
+ let dir = root as Directory ;
53
55
expect ( dir . name ) . to . equal ( "resources.zip" ) ;
54
56
expect ( dir . files . length ) . to . equal ( 1 ) ;
55
57
expect ( dir . files [ 0 ] ) . to . be . instanceof ( Directory ) ;
@@ -61,7 +63,7 @@ describe('Lionweb integration', function() {
61
63
expect ( file . name ) . to . equal ( "delegate.egl" ) ;
62
64
expect ( file . contents . substring ( 0 , 10 ) ) . to . equal ( "Delegate F" ) ;
63
65
64
- expect ( printSequence ( walk ( root . node ) ) ) . to . equal (
66
+ expect ( printSequence ( walk ( root ) ) ) . to . equal (
65
67
"resources.zip, resources, delegate.egl, rosetta-code-count-examples-2.egl, " +
66
68
"rosetta-code-count-examples-1.egl, sub1, sub2, foreach.egl, SQLDropTable.egl, for.egl, SQLBatch.egl, " +
67
69
"SQLCreateTable.egl, SQLDropTable.egl, hello.egl, foreach.egl, Calc.egl, SQLBatch.egl, " +
@@ -71,12 +73,12 @@ describe('Lionweb integration', function() {
71
73
72
74
it ( "can deserialize simple model to dynamic nodes" ,
73
75
function ( ) {
74
- const nodes = deserializeChunk ( FS_MODEL , new TylasuInstantiationFacade ( ) , [ FS_LANGUAGE ] , [ ] ) ;
76
+ const nodes = deserializeToTylasuNodes ( FS_MODEL , [ FS_LANGUAGE ] ) ;
75
77
expect ( nodes ) . not . to . be . empty ;
76
78
expect ( nodes . length ) . to . equal ( 1 ) ;
77
- const root = nodes [ 0 ] as TylasuNodeWrapper ;
78
- expect ( root . node ) . to . be . instanceof ( LionwebNode ) ;
79
- let dir = root . node as LionwebNode & any ;
79
+ const root = nodes [ 0 ] ;
80
+ expect ( root ) . to . be . instanceof ( LionwebNode ) ;
81
+ let dir = root as LionwebNode & any ;
80
82
expect ( dir . nodeDefinition . name ) . to . equal ( "Directory" ) ;
81
83
expect ( dir . getAttributeValue ( "name" ) ) . to . equal ( "resources.zip" ) ;
82
84
expect ( dir . files . length ) . to . equal ( 1 ) ;
@@ -91,7 +93,7 @@ describe('Lionweb integration', function() {
91
93
expect ( file . name ) . to . equal ( "delegate.egl" ) ;
92
94
expect ( file . contents . substring ( 0 , 10 ) ) . to . equal ( "Delegate F" ) ;
93
95
94
- expect ( printSequence ( walk ( root . node ) ) ) . to . equal (
96
+ expect ( printSequence ( walk ( root ) ) ) . to . equal (
95
97
"resources.zip, resources, delegate.egl, rosetta-code-count-examples-2.egl, " +
96
98
"rosetta-code-count-examples-1.egl, sub1, sub2, foreach.egl, SQLDropTable.egl, for.egl, SQLBatch.egl, " +
97
99
"SQLCreateTable.egl, SQLDropTable.egl, hello.egl, foreach.egl, Calc.egl, SQLBatch.egl, " +
@@ -101,12 +103,10 @@ describe('Lionweb integration', function() {
101
103
102
104
it ( "supports trace nodes" ,
103
105
function ( ) {
104
- const nodes = deserializeChunk ( FS_MODEL , new TylasuInstantiationFacade ( ) , [ FS_LANGUAGE ] , [ ] ) ;
106
+ const nodes = deserializeToTraceNodes ( FS_MODEL , [ FS_LANGUAGE ] ) ;
105
107
expect ( nodes ) . not . to . be . empty ;
106
108
expect ( nodes . length ) . to . equal ( 1 ) ;
107
- const root = nodes [ 0 ] as TylasuNodeWrapper ;
108
- expect ( root . node ) . to . be . instanceof ( LionwebNode ) ;
109
- let dir = new TraceNode ( root . node as LionwebNode ) ;
109
+ let dir = nodes [ 0 ] ;
110
110
expect ( dir . nodeDefinition ) . not . to . be . undefined ;
111
111
expect ( dir . getRole ( ) ) . to . be . undefined ;
112
112
expect ( dir . nodeDefinition . name ) . to . equal ( "Directory" ) ;
@@ -124,7 +124,7 @@ describe('Lionweb integration', function() {
124
124
expect ( file . getRole ( ) ) . to . equal ( "files" ) ;
125
125
expect ( file . getPathFromRoot ( ) ) . to . eql ( [ "files" , 0 , "files" , 1 ] ) ;
126
126
127
- expect ( printSequence ( walk ( root . node ) ) ) . to . equal (
127
+ expect ( printSequence ( walk ( nodes [ 0 ] ) ) ) . to . equal (
128
128
"resources.zip, resources, delegate.egl, rosetta-code-count-examples-2.egl, " +
129
129
"rosetta-code-count-examples-1.egl, sub1, sub2, foreach.egl, SQLDropTable.egl, for.egl, SQLBatch.egl, " +
130
130
"SQLCreateTable.egl, SQLDropTable.egl, hello.egl, foreach.egl, Calc.egl, SQLBatch.egl, " +
@@ -133,12 +133,10 @@ describe('Lionweb integration', function() {
133
133
} ) ;
134
134
it ( "trace nodes don't include the position as a child" ,
135
135
function ( ) {
136
- const nodes = deserializeChunk ( EGL_MODEL , new TylasuInstantiationFacade ( ) , [ EGL_LANGUAGE , STARLASU_LANGUAGE ] , [ ] ) ;
136
+ const nodes = deserializeToTraceNodes ( EGL_MODEL , [ EGL_LANGUAGE ] ) ;
137
137
expect ( nodes ) . not . to . be . empty ;
138
- expect ( nodes . length ) . to . equal ( 4 ) ;
139
- const root = nodes [ 0 ] as TylasuNodeWrapper ;
140
- expect ( root . node ) . to . be . instanceof ( LionwebNode ) ;
141
- const dir = new TraceNode ( root . node as LionwebNode ) ;
138
+ expect ( nodes . length ) . to . equal ( 1 ) ;
139
+ const dir = nodes [ 0 ] ;
142
140
expect ( dir . nodeDefinition ) . not . to . be . undefined ;
143
141
expect ( dir . getRole ( ) ) . to . be . undefined ;
144
142
expect ( dir . nodeDefinition . name ) . to . equal ( "EglCompilationUnit" ) ;
0 commit comments