@@ -23,19 +23,22 @@ import { isNatField } from '../src/validation';
2323
2424describe ( 'edge cases' , ( ) => {
2525 test . each ( [
26- [ '_ n:(## 2) c:(n * Cell) = X;' , null ] ,
27- [ '_ n:(## 2) c:(n * ^Cell) = X;' , null ] ,
28- [ '_ x:# = X;' , null ] ,
29- [ 'test$10 = Test;' , 'binary' as const ] ,
30- [ 'test#0a = Test;' , 'hex' as const ] ,
31- [ 'test = Test;' , null ] ,
32- [ '_ {n:#} = X (n + 1 + 2);' , null ] ,
33- [ '_ {n:#} l:(## (n * 2 * 4)) = X;' , null ] ,
34- ] ) ( 'parse & ast: %s' , ( schema : string , tagType : 'binary' | 'hex' | null ) => {
26+ [ 'a,b#00000001 = Ab;' , 'hex' , 'a_b' ] ,
27+ [ '_ n:(## 2) c:(n * Cell) = X;' , null , '_' ] ,
28+ [ '_ n:(## 2) c:(n * ^Cell) = X;' , null , '_' ] ,
29+ [ '_ x:# = X;' , null , '_' ] ,
30+ [ 'test$10 = Test;' , 'binary' , 'test' ] ,
31+ [ 'test#0a = Test;' , 'hex' , 'test' ] ,
32+ [ 'test = Test;' , null , 'test' ] ,
33+ [ '_ {n:#} = X (n + 1 + 2);' , null , '_' ] ,
34+ [ '_ {n:#} l:(## (n * 2 * 4)) = X;' , null , '_' ] ,
35+ ] ) ( 'parse & ast: %s' , ( schema : string , tagType : string | null , constName : string ) => {
3536 expect ( parse ( schema ) . succeeded ( ) ) . toBe ( true ) ;
3637 const tree = ast ( schema ) ;
3738 expect ( tree ) . toBeInstanceOf ( Program ) ;
38- expect ( tree . declarations [ 0 ] ! . constructorDef . getTagType ( ) ) . toBe ( tagType ) ;
39+ const declaration = tree . declarations [ 0 ] ! ;
40+ expect ( declaration . constructorDef . name ) . toBe ( constName ) ;
41+ expect ( declaration . constructorDef . getTagType ( ) ) . toBe ( tagType ) ;
3942 } ) ;
4043
4144 test ( 'withParents handles all cases' , ( ) => {
0 commit comments