@@ -1877,22 +1877,59 @@ test('correct ranges (#427)', async () => {
18771877 expect ( constants [ 3 ] . keyword [ `CONST` ] ) . toBe ( `9` ) ;
18781878} ) ;
18791879
1880- // test('scoobydo', async () => {
1881- // const content = await getFileContent(path.join(__dirname, `..`, `rpgle`, `testing.rpgle`));
1882- // const lines = content.split(/\r?\n/);
1883- // const cache = await parser.getDocs(uri, content, { ignoreCache: true, withIncludes: false });
1880+ test ( 'that symbols can be defined correctly' , async ( ) => {
1881+ const lines = [
1882+ `` ,
1883+ ` D SAMPLEPG Ds Qualified ` ,
1884+ ` dcl-s myprogramText char(20);` ,
1885+ ` dcl-s sampleDcl char(2);` ,
1886+ ` dcl-enum ENUMTEST qualified;` ,
1887+ ` CONSTANT1 value1;` ,
1888+ ` CONSTANT2 value2;` ,
1889+ ` end-enum;` ,
1890+ ` ` ,
1891+ ` dcl-proc testing123 ;` ,
1892+ ` dcl-pi *n ;` ,
1893+ ` end-pi;` ,
1894+ ` ` ,
1895+ ` end-proc;` ,
1896+ ` ` ,
1897+ ] . join ( `\n` ) ;
18841898
1885- // const kill = cache.findAll(`kill`);
1886-
1887- // const killPrototype = kill[0];
1888- // expect(killPrototype.name).toBe(`kill`);
1889- // expect(killPrototype.prototype).toBeTruthy();
1890- // expect(killPrototype.range.start).toBe(71);
1891- // expect(killPrototype.range.end).toBe(74);
1892-
1893- // const killProc = kill[1];
1894- // expect(killProc.name).toBe(`kill`);
1895- // expect(killProc.prototype).toBeFalsy();
1896- // expect(killProc.range.start).toBe(741);
1897- // expect(killProc.range.end).toBe(761);
1898- // });
1899+ const cache = await parser . getDocs ( uri , lines , { ignoreCache : true , withIncludes : false , collectReferences : true } ) ;
1900+
1901+ expect ( cache . structs . length ) . toBe ( 1 ) ;
1902+ expect ( cache . constants . length ) . toBe ( 1 ) ;
1903+ expect ( cache . variables . length ) . toBe ( 2 ) ;
1904+ expect ( cache . procedures . length ) . toBe ( 1 ) ;
1905+ } ) ;
1906+
1907+ test ( 'that mixed symbols can be defined correctly' , async ( ) => {
1908+ const lines = [
1909+ `` ,
1910+ `` ,
1911+ ` D SAMPLEPG Ds Qualified` ,
1912+ ` F TEST ` ,
1913+ ` dcl-s myprogramText char(20);` ,
1914+ ` dcl-s sampleDcl char(2);` ,
1915+ ` dcl-enum ENUMTEST qualified;` ,
1916+ ` CONSTANT1 value1;` ,
1917+ ` CONSTANT2 value2;` ,
1918+ ` end-enum;` ,
1919+ ` ` ,
1920+ ` dcl-proc testing123 ;` ,
1921+ ` dcl-pi *n ;` ,
1922+ ` end-pi;` ,
1923+ ` ` ,
1924+ ` end-proc;` ,
1925+ ` ` ,
1926+ ] . join ( `\n` ) ;
1927+
1928+ const cache = await parser . getDocs ( uri , lines , { ignoreCache : true , withIncludes : false , collectReferences : true } ) ;
1929+
1930+ expect ( cache . structs . length ) . toBe ( 1 ) ;
1931+ expect ( cache . files . length ) . toBe ( 1 ) ;
1932+ expect ( cache . constants . length ) . toBe ( 1 ) ;
1933+ expect ( cache . variables . length ) . toBe ( 2 ) ;
1934+ expect ( cache . procedures . length ) . toBe ( 1 ) ;
1935+ } ) ;
0 commit comments