this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add markdown generator tests for ADT constructors

Tests for variant types, polymorphic variants, and module includes
to validate the fully-qualified-paths markdown output.

Cherry-picked from jonludlam/odoc@c372810a5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+280
+85
test/markdown/adt_constructors.t/colors.mli
··· 1 + (** A module demonstrating ADT with many constructors for markdown output testing. *) 2 + 3 + (** A color type with many variants representing different colors and color properties. *) 4 + type color = 5 + | Red (** Primary red color *) 6 + | Green (** Primary green color *) 7 + | Blue (** Primary blue color *) 8 + | Yellow (** Yellow color (red + green) *) 9 + | Cyan (** Cyan color (green + blue) *) 10 + | Magenta (** Magenta color (red + blue) *) 11 + | Orange (** Orange color *) 12 + | Purple (** Purple color *) 13 + | Pink (** Pink color *) 14 + | Brown (** Brown color *) 15 + | Black (** Black color (absence of light) *) 16 + | White (** White color (all colors combined) *) 17 + | Gray (** Gray color *) 18 + | Silver (** Silver color *) 19 + | Gold (** Gold color *) 20 + | Maroon (** Dark red color *) 21 + | Navy (** Dark blue color *) 22 + | Teal (** Dark cyan color *) 23 + | Lime (** Bright green color *) 24 + | Olive (** Dark yellow-green color *) 25 + | Aqua (** Light blue-green color *) 26 + | Fuchsia (** Bright pink-purple color *) 27 + | Indigo (** Deep blue-purple color *) 28 + | Violet (** Blue-purple color *) 29 + | Turquoise (** Blue-green color *) 30 + | Coral (** Orange-pink color *) 31 + | Salmon (** Light orange-pink color *) 32 + | Crimson (** Deep red color *) 33 + | Scarlet (** Bright red color *) 34 + | Azure (** Light blue color *) 35 + | Beige (** Light brown color *) 36 + | Khaki (** Light brown-green color *) 37 + | Lavender (** Light purple color *) 38 + | Mint (** Light green color *) 39 + | Peach (** Light orange color *) 40 + | Plum (** Dark purple color *) 41 + | Rust (** Orange-red color *) 42 + | Tan (** Light brown color *) 43 + | Ivory (** Off-white color *) 44 + | Pearl (** Lustrous white color *) 45 + | RGB of int * int * int (** RGB color with red, green, blue values (0-255) *) 46 + | RGBA of int * int * int * float (** RGBA color with alpha transparency (0.0-1.0) *) 47 + | HSL of int * int * int (** HSL color with hue (0-360), saturation, lightness (0-100) *) 48 + | HSV of int * int * int (** HSV color with hue (0-360), saturation, value (0-100) *) 49 + | CMYK of int * int * int * int (** CMYK color for printing (0-100 each) *) 50 + | Hex of string (** Hexadecimal color representation (e.g., "#FF0000") *) 51 + | Named of string (** Named color (e.g., "forestgreen", "dodgerblue") *) 52 + | Gradient of color * color (** Gradient between two colors *) 53 + | Pattern of color list (** Pattern of multiple colors *) 54 + | Custom of string * (int * int * int) (** Custom color with name and RGB values *) 55 + 56 + (** Brightness levels for colors. *) 57 + type brightness = 58 + | VeryDark (** Very dark variant *) 59 + | Dark (** Dark variant *) 60 + | Normal (** Normal brightness *) 61 + | Light (** Light variant *) 62 + | VeryLight (** Very light variant *) 63 + 64 + (** Color temperature classification. *) 65 + type temperature = 66 + | VeryWarm (** Very warm colors (reds, oranges) *) 67 + | Warm (** Warm colors *) 68 + | Neutral (** Neutral temperature *) 69 + | Cool (** Cool colors *) 70 + | VeryCool (** Very cool colors (blues, purples) *) 71 + 72 + (** A function to get the default RGB values for a color. *) 73 + val to_rgb : color -> int * int * int 74 + 75 + (** Convert a color to its brightness classification. *) 76 + val get_brightness : color -> brightness 77 + 78 + (** Get the temperature classification of a color. *) 79 + val get_temperature : color -> temperature 80 + 81 + (** Mix two colors together. *) 82 + val mix_colors : color -> color -> color 83 + 84 + (** Create a complementary color. *) 85 + val complement : color -> color
+124
test/markdown/adt_constructors.t/run.t
··· 1 + Test the markdown output for a module with an ADT containing many constructors. 2 + This test verifies that the markdown generator properly handles large ADTs with 3 + various constructor types including simple variants, variants with parameters, 4 + and proper documentation rendering. 5 + 6 + $ ocamlc -c -bin-annot colors.mli 7 + $ odoc compile --package colors colors.cmti 8 + $ odoc link colors.odoc 9 + $ odoc markdown-generate colors.odocl -o markdown 10 + 11 + $ cat markdown/colors/Colors.md 12 + 13 + # Module `Colors` 14 + 15 + A module demonstrating ADT with many constructors for markdown output testing. 16 + 17 + ``` 18 + type color = 19 + | Red (** Primary red color *) 20 + | Green (** Primary green color *) 21 + | Blue (** Primary blue color *) 22 + | Yellow (** Yellow color (red + green) *) 23 + | Cyan (** Cyan color (green + blue) *) 24 + | Magenta (** Magenta color (red + blue) *) 25 + | Orange (** Orange color *) 26 + | Purple (** Purple color *) 27 + | Pink (** Pink color *) 28 + | Brown (** Brown color *) 29 + | Black (** Black color (absence of light) *) 30 + | White (** White color (all colors combined) *) 31 + | Gray (** Gray color *) 32 + | Silver (** Silver color *) 33 + | Gold (** Gold color *) 34 + | Maroon (** Dark red color *) 35 + | Navy (** Dark blue color *) 36 + | Teal (** Dark cyan color *) 37 + | Lime (** Bright green color *) 38 + | Olive (** Dark yellow-green color *) 39 + | Aqua (** Light blue-green color *) 40 + | Fuchsia (** Bright pink-purple color *) 41 + | Indigo (** Deep blue-purple color *) 42 + | Violet (** Blue-purple color *) 43 + | Turquoise (** Blue-green color *) 44 + | Coral (** Orange-pink color *) 45 + | Salmon (** Light orange-pink color *) 46 + | Crimson (** Deep red color *) 47 + | Scarlet (** Bright red color *) 48 + | Azure (** Light blue color *) 49 + | Beige (** Light brown color *) 50 + | Khaki (** Light brown-green color *) 51 + | Lavender (** Light purple color *) 52 + | Mint (** Light green color *) 53 + | Peach (** Light orange color *) 54 + | Plum (** Dark purple color *) 55 + | Rust (** Orange-red color *) 56 + | Tan (** Light brown color *) 57 + | Ivory (** Off-white color *) 58 + | Pearl (** Lustrous white color *) 59 + | RGB of int * int * int (** RGB color with red, green, blue values (0-255) *) 60 + | RGBA of int * int * int * float (** RGBA color with alpha transparency (0.0-1.0) *) 61 + | HSL of int * int * int (** HSL color with hue (0-360), saturation, lightness (0-100) *) 62 + | HSV of int * int * int (** HSV color with hue (0-360), saturation, value (0-100) *) 63 + | CMYK of int * int * int * int (** CMYK color for printing (0-100 each) *) 64 + | Hex of string (** Hexadecimal color representation (e.g., "#FF0000") *) 65 + | Named of string (** Named color (e.g., "forestgreen", "dodgerblue") *) 66 + | Gradient of Colors.color * Colors.color (** Gradient between two colors *) 67 + | Pattern of Colors.color list (** Pattern of multiple colors *) 68 + | Custom of string * int * int * int (** Custom color with name and RGB values *) 69 + ``` 70 + ``` 71 + 72 + ``` 73 + A color type with many variants representing different colors and color properties. 74 + 75 + ``` 76 + type brightness = 77 + | VeryDark (** Very dark variant *) 78 + | Dark (** Dark variant *) 79 + | Normal (** Normal brightness *) 80 + | Light (** Light variant *) 81 + | VeryLight (** Very light variant *) 82 + ``` 83 + ``` 84 + 85 + ``` 86 + Brightness levels for colors. 87 + 88 + ``` 89 + type temperature = 90 + | VeryWarm (** Very warm colors (reds, oranges) *) 91 + | Warm (** Warm colors *) 92 + | Neutral (** Neutral temperature *) 93 + | Cool (** Cool colors *) 94 + | VeryCool (** Very cool colors (blues, purples) *) 95 + ``` 96 + ``` 97 + 98 + ``` 99 + Color temperature classification. 100 + 101 + ``` 102 + val to_rgb : Colors.color -> int * int * int 103 + ``` 104 + A function to get the default RGB values for a color. 105 + 106 + ``` 107 + val get_brightness : Colors.color -> Colors.brightness 108 + ``` 109 + Convert a color to its brightness classification. 110 + 111 + ``` 112 + val get_temperature : Colors.color -> Colors.temperature 113 + ``` 114 + Get the temperature classification of a color. 115 + 116 + ``` 117 + val mix_colors : Colors.color -> Colors.color -> Colors.color 118 + ``` 119 + Mix two colors together. 120 + 121 + ``` 122 + val complement : Colors.color -> Colors.color 123 + ``` 124 + Create a complementary color.
+3
test/markdown/dune
··· 1 + (cram 2 + (package odoc) 3 + (deps %{bin:odoc}))
+19
test/markdown/polymorphic_variants.t/polymorphic_variants.mli
··· 1 + (** A module demonstrating polymorphic variants for markdown output testing. *) 2 + 3 + (** A polymorphic variant type with many constructors. *) 4 + type color = [ 5 + | `Red (** Primary red color *) 6 + | `Green (** Primary green color *) 7 + | `Blue (** Primary blue color *) 8 + | `Yellow (** Yellow color *) 9 + | `Orange (** Orange color *) 10 + | `Purple (** Purple color *) 11 + | `RGB of int * int * int (** RGB values *) 12 + | `Named of string (** Named color *) 13 + ] 14 + 15 + (** Simple fixed polymorphic variant. *) 16 + type status = [ `Active | `Inactive of string ] 17 + 18 + (** Another simple polymorphic variant. *) 19 + type simple = [ `A | `B | `C ]
+49
test/markdown/polymorphic_variants.t/run.t
··· 1 + Test polymorphic variant formatting in markdown output. 2 + 3 + $ ocamlc -c -bin-annot polymorphic_variants.mli 4 + $ odoc compile --package test polymorphic_variants.cmti 5 + $ odoc link polymorphic_variants.odoc 6 + $ odoc markdown-generate polymorphic_variants.odocl -o markdown 7 + 8 + $ cat markdown/test/Polymorphic_variants.md 9 + 10 + # Module `Polymorphic_variants` 11 + 12 + A module demonstrating polymorphic variants for markdown output testing. 13 + 14 + ``` 15 + type color = [ 16 + | `Red (** Primary red color *) 17 + | `Green (** Primary green color *) 18 + | `Blue (** Primary blue color *) 19 + | `Yellow (** Yellow color *) 20 + | `Orange (** Orange color *) 21 + | `Purple (** Purple color *) 22 + | `RGB of int * int * int (** RGB values *) 23 + | `Named of string (** Named color *) 24 + ``` 25 + ``` 26 + ] 27 + ``` 28 + A polymorphic variant type with many constructors. 29 + 30 + ``` 31 + type status = [ 32 + | `Active 33 + | `Inactive of string 34 + ``` 35 + ``` 36 + ] 37 + ``` 38 + Simple fixed polymorphic variant. 39 + 40 + ``` 41 + type simple = [ 42 + | `A 43 + | `B 44 + | `C 45 + ``` 46 + ``` 47 + ] 48 + ``` 49 + Another simple polymorphic variant.