From a320eab4c1d5e34ae5e50bb63f38500e67ddd5f2 Mon Sep 17 00:00:00 2001 From: Eksperimental Date: Mon, 18 Apr 2022 16:02:10 +0000 Subject: [PATCH] Add tests for license files and all files in .build (#1556) Related PR: https://github.com/elixir-lang/ex_doc/pull/1553 --- test/ex_doc/formatter/html_test.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/ex_doc/formatter/html_test.exs b/test/ex_doc/formatter/html_test.exs index d238be6f0..fd7b891f9 100644 --- a/test/ex_doc/formatter/html_test.exs +++ b/test/ex_doc/formatter/html_test.exs @@ -568,14 +568,27 @@ defmodule ExDoc.Formatter.HTMLTest do config = doc_config(extras: ["test/fixtures/README.md"], logo: "test/fixtures/elixir.png") generate_docs(config) content = File.read!("#{output_dir()}/.build") + + # Verify necessary files in .build assert content =~ ~r(^readme\.html$)m assert content =~ ~r(^api-reference\.html$)m assert content =~ ~r(^dist/sidebar_items-[\w]{10}\.js$)m assert content =~ ~r(^dist/app-[\w]{20}\.js$)m + assert content =~ ~r(^dist/app-[\w]{20}\.js.LICENSE.txt$)m assert content =~ ~r(^dist/elixir-[\w]{20}\.css$)m assert content =~ ~r(^assets/logo\.png$)m assert content =~ ~r(^index\.html$)m assert content =~ ~r(^404\.html$)m + + # Verify the files listed in .build actually exist + files = + content + |> String.split("\n", trim: true) + |> Enum.map(&Path.join(output_dir(), &1)) + + for file <- files do + assert File.exists?(file) + end end test "does not delete files not listed in .build" do