|
| 1 | +Test that @canonical tags work on compilation units when it is placed in the |
| 2 | +top-comment. |
| 3 | + |
| 4 | +The module Test_x is expected to be referenced as Test.X. |
| 5 | + |
| 6 | + $ compile test_x.mli test_y.ml test.ml |
| 7 | + |
| 8 | +Test_x and Test_y have a 'canonical' field: |
| 9 | + |
| 10 | + $ odoc_print test_x.odocl | jq -c ".canonical" |
| 11 | + {"Some":{"`Dot":[{"`Root":"Test"},"X"]}} |
| 12 | + $ odoc_print test_y.odocl | jq -c ".canonical" |
| 13 | + {"Some":{"`Dot":[{"`Root":"Test"},"Y"]}} |
| 14 | + |
| 15 | +Test_x is defined as a .mli file and Test_y as a .ml file in order to test the |
| 16 | +loader code handling canonical tags. |
| 17 | + |
| 18 | +Submodules *_out have the canonical tag in the declarations and submodules *_in |
| 19 | +have it in the top-comment. |
| 20 | + |
| 21 | +Every references should be marked as canonical: |
| 22 | + |
| 23 | + $ odoc_print test.odocl | jq -c ".content.Module.items | .[] | .Module[1].type_.Alias[0] | select(.)" |
| 24 | + {"`Resolved":{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X"]}}]}}]}} |
| 25 | + {"`Resolved":{"`Canonical":[{"`Module":[{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X"]}}]}}]},"Out"]},{"`Resolved":{"`Alias":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},"Out"]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X_out"]}}]}}]}} |
| 26 | + {"`Resolved":{"`Canonical":[{"`Module":[{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X"]}}]}}]},"In"]},{"`Resolved":{"`Alias":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_x"]}},"In"]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"X_in"]}}]}}]}} |
| 27 | + {"`Resolved":{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y"]}}]}}]}} |
| 28 | + {"`Resolved":{"`Canonical":[{"`Module":[{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y"]}}]}}]},"Out"]},{"`Resolved":{"`Alias":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},"Out"]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y_out"]}}]}}]}} |
| 29 | + {"`Resolved":{"`Canonical":[{"`Module":[{"`Canonical":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Resolved":{"`Alias":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y"]}}]}}]},"In"]},{"`Resolved":{"`Alias":[{"`Module":[{"`Identifier":{"`Root":[{"`RootPage":"test"},"Test_y"]}},"In"]},{"`Identifier":{"`Module":[{"`Root":[{"`RootPage":"test"},"Test"]},"Y_in"]}}]}}]}} |
0 commit comments