@@ -50,23 +50,46 @@ You can run tests using the following methods:
5050# Run all tests
5151dune runtest
5252
53- # Run tests in a specific directory
54- dune runtest test/
53+ # Run specific tests:
54+ dune exec test/test_cmt_values.exe # Directly execute the test
55+ dune exec test/test_cmt_imports.exe # Directly execute the test
5556
56- # Run specific tests
57- dune runtest test/test_cmt_imports.exe
58- dune runtest test/test_cmt_values.exe
59-
60- # Run tests directly
61- dune exec test/test_cmt_imports.exe
57+ # Run benchmark
58+ dune build @bench # Build and run the benchmark
59+ dune exec test/benchmark.exe # Directly execute the benchmark
6260```
6361
6462Test code is located in the ` test/ ` directory and includes the following tests:
6563
6664- ` test_cmt_imports.ml ` : Tests the import information from cmt files.
6765- ` test_cmt_values.ml ` : Tests the value dependency information from cmt files.
66+ - ` test_rescriptdep.ml ` : Basic smoke test for the rescriptdep functionality.
67+ - ` benchmark.ml ` : Performance benchmark for the parser.
68+
69+ #### Running the Benchmark
70+
71+ The benchmark is designed to be run separately from the regular tests and requires a ReScript project with compiled .cmt files to analyze:
72+
73+ ``` bash
74+ # Run the benchmark with a specific ReScript project
75+ RESCRIPTDEP_BENCHMARK_PATH=/path/to/rescript/project/lib/bs/src dune exec test/benchmark.exe
76+
77+ # Example with environment variables for detailed output
78+ RESCRIPTDEP_BENCHMARK=1 RESCRIPTDEP_VERBOSE=1 RESCRIPTDEP_BENCHMARK_PATH=/path/to/project/lib/bs/src dune exec test/benchmark.exe
79+ ```
80+
81+ When running as part of ` dune runtest ` , the benchmark will be skipped automatically.
82+
83+ #### Test Fixtures
84+
85+ Fixture files used by tests are located in the ` test/fixtures/ ` directory. These files include:
86+
87+ - ` app.cmt ` : Example application module.
88+ - ` math.cmt ` : Example math utility module.
89+ - ` logger.cmt ` : Example logging module.
90+ - ` utils.cmt ` : Example utilities module.
6891
69- When modifying test code, check the configuration in the ` test/dune ` file. Fixture files used by tests are located in the ` test/fixtures/ ` directory.
92+ Tests automatically locate these fixture files, so they should work correctly regardless of your current working directory.
7093
7194## License
7295
0 commit comments