<commit_before>Code.require_file "../../../test_helper.exs", __FILE__

defmodule Mix.Tasks.NewTest do
  use MixTest.Case

  test "new with underscore" do
    in_tmp "new with underscore", fn ->
      Mix.Tasks.New.run ["hello_world"]

      assert_file "hello_world/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
      end

      assert_file "hello_world/README.md", %r/# HelloWorld/
      assert_file "hello_world/.gitignore"

      assert_file "hello_world/lib/hello_world.ex",  %r/defmodule HelloWorld do/

      assert_file "hello_world/test/test_helper.exs", %r/HelloWorld.start/
      assert_file "hello_world/test/hello_world_test.exs", %r/defmodule HelloWorldTest do/

      assert_received { :mix_shell, :info, ["* creating mix.exs"] }
      assert_received { :mix_shell, :info, ["* creating lib/hello_world.ex"] }
    end
  end

  test "new with camelize" do
    in_tmp "new with camelize", fn ->
      Mix.Tasks.New.run ["HelloWorld"]

      assert_file "HelloWorld/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
      end

      assert_file "HelloWorld/README.md", %r/# HelloWorld/
      assert_file "HelloWorld/.gitignore"

      assert_file "HelloWorld/lib/hello_world.ex", %r/defmodule HelloWorld do/

      assert_file "HelloWorld/test/test_helper.exs", %r/HelloWorld.start/
      assert_file "HelloWorld/test/hello_world_test.exs", %r/defmodule HelloWorldTest do/

      assert_received { :mix_shell, :info, ["* creating mix.exs"] }
      assert_received { :mix_shell, :info, ["* creating lib/hello_world.ex"] }
    end
  end

  test "new with --sup" do
    in_tmp "new with underscore", fn ->
      Mix.Tasks.New.run ["hello_world", "--sup"]

      assert_file "hello_world/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
        assert file =~ %r/[mod: { HelloWorld, \[\] }]/
      end

      assert_file "hello_world/README.md", %r/# HelloWorld/
      assert_file "hello_world/.gitignore"

      assert_file "hello_world/lib/hello_world.ex", fn(file) ->
        assert file =~ %r/defmodule HelloWorld do/
        assert file =~ %r/use Application.Behaviour/
        assert file =~ %r/HelloWorld.Supervisor.start_link/
      end

      assert_file "hello_world/lib/hello_world/supervisor.ex", fn(file) ->
        assert file =~ %r/defmodule HelloWorld.Supervisor do/
        assert file =~ %r/supervise children, strategy: :one_for_one/
      end<commit_msg>add some missing parenthesis in an assert<commit_after>Code.require_file "../../../test_helper.exs", __FILE__

defmodule Mix.Tasks.NewTest do
  use MixTest.Case

  test "new with underscore" do
    in_tmp "new with underscore", fn ->
      Mix.Tasks.New.run ["hello_world"]

      assert_file "hello_world/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
      end

      assert_file "hello_world/README.md", %r/# HelloWorld/
      assert_file "hello_world/.gitignore"

      assert_file "hello_world/lib/hello_world.ex",  %r/defmodule HelloWorld do/

      assert_file "hello_world/test/test_helper.exs", %r/HelloWorld.start/
      assert_file "hello_world/test/hello_world_test.exs", %r/defmodule HelloWorldTest do/

      assert_received { :mix_shell, :info, ["* creating mix.exs"] }
      assert_received { :mix_shell, :info, ["* creating lib/hello_world.ex"] }
    end
  end

  test "new with camelize" do
    in_tmp "new with camelize", fn ->
      Mix.Tasks.New.run ["HelloWorld"]

      assert_file "HelloWorld/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
      end

      assert_file "HelloWorld/README.md", %r/# HelloWorld/
      assert_file "HelloWorld/.gitignore"

      assert_file "HelloWorld/lib/hello_world.ex", %r/defmodule HelloWorld do/

      assert_file "HelloWorld/test/test_helper.exs", %r/HelloWorld.start/
      assert_file "HelloWorld/test/hello_world_test.exs", %r/defmodule HelloWorldTest do/

      assert_received { :mix_shell, :info, ["* creating mix.exs"] }
      assert_received { :mix_shell, :info, ["* creating lib/hello_world.ex"] }
    end
  end

  test "new with --sup" do
    in_tmp "new with underscore", fn ->
      Mix.Tasks.New.run ["hello_world", "--sup"]

      assert_file "hello_world/mix.exs", fn(file) ->
        assert file =~ %r/app: :hello_world/
        assert file =~ %r/version: "0.0.1"/
        assert file =~ %r/[mod: { HelloWorld, \[\] }]/
      end

      assert_file "hello_world/README.md", %r/# HelloWorld/
      assert_file "hello_world/.gitignore"

      assert_file "hello_world/lib/hello_world.ex", fn(file) ->
        assert file =~ %r/defmodule HelloWorld do/
        assert file =~ %r/use Application.Behaviour/
        assert file =~ %r/HelloWorld.Supervisor.start_link/
      end

      assert_file "hello_world/lib/hello_world/supervisor.ex", fn(file) ->
        assert file =~ %r/defmodule HelloWorld.Supervisor do/
        assert file =~ %r/supervise\(children, strategy: :one_for_one\)/
      end
{'fraction_non_alphanumeric': 0.14011999225856397, 'fraction_numerical': 0.0034836462163731373, 'mean_word_length': 2.7833089311859442, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6797047', 'n_tokens_mistral': 1805, 'n_tokens_neox': 1747, 'n_words': 372}