diff --git a/test/fixtures/unittest/03_core_cache/bib/1.bib b/test/fixtures/unittest/03_core_cache/update_bibfiles/bib/1.bib similarity index 100% rename from test/fixtures/unittest/03_core_cache/bib/1.bib rename to test/fixtures/unittest/03_core_cache/update_bibfiles/bib/1.bib diff --git a/test/fixtures/unittest/03_core_cache/bib/2.bib b/test/fixtures/unittest/03_core_cache/update_bibfiles/bib/2.bib similarity index 100% rename from test/fixtures/unittest/03_core_cache/bib/2.bib rename to test/fixtures/unittest/03_core_cache/update_bibfiles/bib/2.bib diff --git a/test/fixtures/unittest/03_core_cache/bib/3.bib b/test/fixtures/unittest/03_core_cache/update_bibfiles/bib/3.bib similarity index 100% rename from test/fixtures/unittest/03_core_cache/bib/3.bib rename to test/fixtures/unittest/03_core_cache/update_bibfiles/bib/3.bib diff --git a/test/fixtures/unittest/03_core_cache/bib/4.bib b/test/fixtures/unittest/03_core_cache/update_bibfiles/bib/4.bib similarity index 100% rename from test/fixtures/unittest/03_core_cache/bib/4.bib rename to test/fixtures/unittest/03_core_cache/update_bibfiles/bib/4.bib diff --git a/test/fixtures/unittest/03_core_cache/bib/5.bib b/test/fixtures/unittest/03_core_cache/update_bibfiles/bib/5.bib similarity index 100% rename from test/fixtures/unittest/03_core_cache/bib/5.bib rename to test/fixtures/unittest/03_core_cache/update_bibfiles/bib/5.bib diff --git a/test/fixtures/unittest/03_core_cache/update_bibfiles_file_excluded.tex b/test/fixtures/unittest/03_core_cache/update_bibfiles/file_excluded.tex similarity index 67% rename from test/fixtures/unittest/03_core_cache/update_bibfiles_file_excluded.tex rename to test/fixtures/unittest/03_core_cache/update_bibfiles/file_excluded.tex index d8aaf59c5..c166140cf 100644 --- a/test/fixtures/unittest/03_core_cache/update_bibfiles_file_excluded.tex +++ b/test/fixtures/unittest/03_core_cache/update_bibfiles/file_excluded.tex @@ -1,4 +1,4 @@ \documentclass{article} \begin{document} -\bibliography{main.bbl} +\bibliography{../main.bbl} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_bibfiles_file_not_exist.tex b/test/fixtures/unittest/03_core_cache/update_bibfiles/file_not_exist.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/update_bibfiles_file_not_exist.tex rename to test/fixtures/unittest/03_core_cache/update_bibfiles/file_not_exist.tex diff --git a/test/fixtures/unittest/03_core_cache/update_bibfiles.tex b/test/fixtures/unittest/03_core_cache/update_bibfiles/main.tex similarity index 88% rename from test/fixtures/unittest/03_core_cache/update_bibfiles.tex rename to test/fixtures/unittest/03_core_cache/update_bibfiles/main.tex index dfd2584a2..5a51a14df 100644 --- a/test/fixtures/unittest/03_core_cache/update_bibfiles.tex +++ b/test/fixtures/unittest/03_core_cache/update_bibfiles/main.tex @@ -1,6 +1,6 @@ \documentclass{article} \begin{document} -\bibliography{main.bib} +\bibliography{../main.bib} \addbibresource{bib/1.bib} \bibliography{\subfix{bib/2.bib}} \addbibresource{\subfix{bib/3.bib}} diff --git a/test/fixtures/unittest/03_core_cache/update_children_two_inputs.tex b/test/fixtures/unittest/03_core_cache/update_bibfiles/same_macro.tex similarity index 59% rename from test/fixtures/unittest/03_core_cache/update_children_two_inputs.tex rename to test/fixtures/unittest/03_core_cache/update_bibfiles/same_macro.tex index fea5fc034..9e2e496d5 100644 --- a/test/fixtures/unittest/03_core_cache/update_children_two_inputs.tex +++ b/test/fixtures/unittest/03_core_cache/update_bibfiles/same_macro.tex @@ -1,5 +1,4 @@ \documentclass{article} \begin{document} -\input{main.tex} -\input{another.tex} +\bibliography{../main.bib, bib/1.bib} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_children_file_not_exist.tex b/test/fixtures/unittest/03_core_cache/update_children/file_not_exist.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/update_children_file_not_exist.tex rename to test/fixtures/unittest/03_core_cache/update_children/file_not_exist.tex diff --git a/test/fixtures/unittest/03_core_cache/update_children_input_main.tex b/test/fixtures/unittest/03_core_cache/update_children/input_main.tex similarity index 73% rename from test/fixtures/unittest/03_core_cache/update_children_input_main.tex rename to test/fixtures/unittest/03_core_cache/update_children/input_main.tex index e320ae8a5..eb2893bb0 100644 --- a/test/fixtures/unittest/03_core_cache/update_children_input_main.tex +++ b/test/fixtures/unittest/03_core_cache/update_children/input_main.tex @@ -1,4 +1,4 @@ \documentclass{article} \begin{document} -\input{main.tex} +\input{../main.tex} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_children/two_inputs.tex b/test/fixtures/unittest/03_core_cache/update_children/two_inputs.tex new file mode 100644 index 000000000..4dc0c13c8 --- /dev/null +++ b/test/fixtures/unittest/03_core_cache/update_children/two_inputs.tex @@ -0,0 +1,5 @@ +\documentclass{article} +\begin{document} +\input{../main.tex} +\input{../another.tex} +\end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_bibfiles_same_macro.tex b/test/fixtures/unittest/03_core_cache/update_children/two_same_inputs.tex similarity index 58% rename from test/fixtures/unittest/03_core_cache/update_bibfiles_same_macro.tex rename to test/fixtures/unittest/03_core_cache/update_children/two_same_inputs.tex index 1ed941637..41227195e 100644 --- a/test/fixtures/unittest/03_core_cache/update_bibfiles_same_macro.tex +++ b/test/fixtures/unittest/03_core_cache/update_children/two_same_inputs.tex @@ -1,4 +1,5 @@ \documentclass{article} \begin{document} -\bibliography{main.bib, bib/1.bib} +\input{../main.tex} +\input{../main.tex} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_children_two_same_inputs.tex b/test/fixtures/unittest/03_core_cache/update_children_two_same_inputs.tex deleted file mode 100644 index 1628edad0..000000000 --- a/test/fixtures/unittest/03_core_cache/update_children_two_same_inputs.tex +++ /dev/null @@ -1,5 +0,0 @@ -\documentclass{article} -\begin{document} -\input{main.tex} -\input{main.tex} -\end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_childrenxr_file_not_exist.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/file_not_exist.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/update_childrenxr_file_not_exist.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/file_not_exist.tex diff --git a/test/fixtures/unittest/03_core_cache/update_childrenxr_input_main.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/input_main.tex similarity index 69% rename from test/fixtures/unittest/03_core_cache/update_childrenxr_input_main.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/input_main.tex index a790fbf24..20dce591f 100644 --- a/test/fixtures/unittest/03_core_cache/update_childrenxr_input_main.tex +++ b/test/fixtures/unittest/03_core_cache/update_children_xr/input_main.tex @@ -1,5 +1,5 @@ \documentclass{article} \usepackage{xr} \begin{document} -\externaldocument{main.tex} +\externaldocument{../main.tex} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_childrenxr_input_main_prefix.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/input_main_prefix.tex similarity index 64% rename from test/fixtures/unittest/03_core_cache/update_childrenxr_input_main_prefix.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/input_main_prefix.tex index 9b9823f57..fb94fdbd0 100644 --- a/test/fixtures/unittest/03_core_cache/update_childrenxr_input_main_prefix.tex +++ b/test/fixtures/unittest/03_core_cache/update_children_xr/input_main_prefix.tex @@ -1,5 +1,5 @@ \documentclass{article} \usepackage{xr} \begin{document} -\externaldocument[prefix]{main.tex} +\externaldocument[prefix]{../main.tex} \end{document} diff --git a/test/fixtures/unittest/03_core_cache/update_childrenxr_input_sub.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/input_sub.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/update_childrenxr_input_sub.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/input_sub.tex diff --git a/test/fixtures/unittest/03_core_cache/sub/main.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/sub/main.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/sub/main.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/sub/main.tex diff --git a/test/fixtures/unittest/03_core_cache/sub/sub.tex b/test/fixtures/unittest/03_core_cache/update_children_xr/sub/sub.tex similarity index 100% rename from test/fixtures/unittest/03_core_cache/sub/sub.tex rename to test/fixtures/unittest/03_core_cache/update_children_xr/sub/sub.tex diff --git a/test/units/03_core_cache.test.ts b/test/units/03_core_cache.test.ts index c1ae9fca6..17ea3f21a 100644 --- a/test/units/03_core_cache.test.ts +++ b/test/units/03_core_cache.test.ts @@ -320,14 +320,14 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should not add a child if the files does not exist', async () => { - const toParse = getPath(fixture, 'update_children_file_not_exist.tex') + const toParse = getPath(fixture, 'update_children', 'file_not_exist.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.strictEqual(lw.cache.get(toParse)?.children.length, 0) }) it('should not add a child if it is the root', async () => { - const toParse = getPath(fixture, 'update_children_input_main.tex') + const toParse = getPath(fixture, 'update_children', 'input_main.tex') setRoot(fixture, 'main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) @@ -335,7 +335,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should add a child and cache it if not cached', async () => { - const toParse = getPath(fixture, 'update_children_input_main.tex') + const toParse = getPath(fixture, 'update_children', 'input_main.tex') setRoot(fixture, 'another.tex') assert.strictEqual(lw.cache.get(texPath), undefined) lw.cache.add(toParse) @@ -346,21 +346,21 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should watch the child', async () => { - const toParse = getPath(fixture, 'update_children_input_main.tex') + const toParse = getPath(fixture, 'update_children', 'input_main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.ok(lw.watcher.src.has(texPath)) }) it('should add two children if there are two inputs', async () => { - const toParse = getPath(fixture, 'update_children_two_inputs.tex') + const toParse = getPath(fixture, 'update_children', 'two_inputs.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.strictEqual(lw.cache.get(toParse)?.children.length, 2) }) it('should add one child if two inputs are identical', async () => { - const toParse = getPath(fixture, 'update_children_two_same_inputs.tex') + const toParse = getPath(fixture, 'update_children', 'two_same_inputs.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.strictEqual(lw.cache.get(toParse)?.children.length, 1) @@ -377,7 +377,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should not add a child if the files does not exist', async () => { - const toParse = getPath(fixture, 'update_childrenxr_file_not_exist.tex') + const toParse = getPath(fixture, 'update_children_xr', 'file_not_exist.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -386,7 +386,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should not add a child if it is the root', async () => { - const toParse = getPath(fixture, 'update_childrenxr_input_main.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main.tex') setRoot(fixture, 'main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) @@ -400,7 +400,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { lw.cache.add(texPathAnother) await lw.cache.refreshCache(texPathAnother) - const toParse = getPath(fixture, 'update_childrenxr_input_main.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) @@ -414,7 +414,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should add a child if it is next to the source', async () => { - const toParse = getPath(fixture, 'update_childrenxr_input_main.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -423,40 +423,40 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should add a child if it is next to the root', async () => { - const rootPath = getPath(fixture, 'sub', 'main.tex') + const rootPath = getPath(fixture, 'update_children_xr', 'sub', 'main.tex') setRoot(rootPath) lw.cache.add(rootPath) await lw.cache.refreshCache(rootPath) - const toParse = getPath(fixture, 'update_childrenxr_input_sub.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_sub.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(rootPath) assert.ok(fileCache) - assert.strictEqual(Object.keys(fileCache.external)[0], getPath(fixture, 'sub', 'sub.tex')) + assert.strictEqual(Object.keys(fileCache.external)[0], getPath(fixture, 'update_children_xr', 'sub', 'sub.tex')) }) it('should add a child if it is defined in `latex.texDirs`', async () => { - await setConfig('latex.texDirs', [ getPath(fixture, 'sub') ]) + await setConfig('latex.texDirs', [ getPath(fixture, 'update_children_xr', 'sub') ]) setRoot(texPath) lw.cache.add(texPath) await lw.cache.refreshCache(texPath) - const toParse = getPath(fixture, 'update_childrenxr_input_sub.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_sub.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(texPath) assert.ok(fileCache) - assert.strictEqual(Object.keys(fileCache.external)[0], getPath(fixture, 'sub', 'sub.tex')) + assert.strictEqual(Object.keys(fileCache.external)[0], getPath(fixture, 'update_children_xr', 'sub', 'sub.tex')) }) it('should add a child and cache it if not cached', async () => { assert.strictEqual(lw.cache.get(texPath), undefined) - const toParse = getPath(fixture, 'update_childrenxr_input_main.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) await lw.cache.wait(texPath, 60) @@ -464,14 +464,14 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should watch the child', async () => { - const toParse = getPath(fixture, 'update_childrenxr_input_main.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.ok(lw.watcher.src.has(texPath)) }) it('should add a child with prefix', async () => { - const toParse = getPath(fixture, 'update_childrenxr_input_main_prefix.tex') + const toParse = getPath(fixture, 'update_children_xr', 'input_main_prefix.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -490,7 +490,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should not add a bib file if the file does not exist', async () => { - const toParse = getPath(fixture, 'update_bibfiles_file_not_exist.tex') + const toParse = getPath(fixture, 'update_bibfiles', 'file_not_exist.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -499,7 +499,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should add bib files with \\bibliography, \\addbibresource, \\putbib, and possible presense of \\subfix', async () => { - const toParse = getPath(fixture, 'update_bibfiles.tex') + const toParse = getPath(fixture, 'update_bibfiles', 'main.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -508,7 +508,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should add multiple bib files in one macro', async () => { - const toParse = getPath(fixture, 'update_bibfiles_same_macro.tex') + const toParse = getPath(fixture, 'update_bibfiles', 'same_macro.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -517,7 +517,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should not add excluded bib files', async () => { - const toParse = getPath(fixture, 'update_bibfiles_file_excluded.tex') + const toParse = getPath(fixture, 'update_bibfiles', 'file_excluded.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) const fileCache = lw.cache.get(toParse) @@ -526,7 +526,7 @@ describe(path.basename(__filename).split('.')[0] + ':', () => { }) it('should watch bib files if added', async () => { - const toParse = getPath(fixture, 'update_bibfiles_same_macro.tex') + const toParse = getPath(fixture, 'update_bibfiles', 'same_macro.tex') lw.cache.add(toParse) await lw.cache.refreshCache(toParse) assert.ok(lw.watcher.bib.has(bibPath))