diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c0496c880..11f0c695a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: - run: mix credo --strict --format=sarif # dialyzer: - # runs-on: ${{ matrix.os || 'ubuntu-20.04' }} + # runs-on: ${{ matrix.os || 'ubuntu-22.04' }} # steps: # - uses: actions/checkout@v4.1.0 @@ -53,7 +53,7 @@ jobs: # - run: mix dialyzer --format github test: - runs-on: ${{ matrix.os || 'ubuntu-20.04' }} + runs-on: ${{ matrix.os || 'ubuntu-22.04' }} steps: - uses: actions/checkout@v4.1.7 - uses: actions/cache@v4.0.2 @@ -70,50 +70,30 @@ jobs: fail-fast: false matrix: include: - - elixir: 1.11.x - otp: 21.x - os: ubuntu-20.04 - - elixir: 1.11.x - otp: 22.x - os: ubuntu-20.04 - - elixir: 1.11.x - otp: 23.x - os: ubuntu-20.04 - - elixir: 1.12.x - otp: 22.x - os: ubuntu-20.04 - - elixir: 1.12.x - otp: 23.x - os: ubuntu-20.04 - - elixir: 1.12.x - otp: 24.x - os: ubuntu-20.04 - - elixir: 1.13.x - otp: 22.x - os: ubuntu-20.04 - - elixir: 1.13.x - otp: 23.x - os: ubuntu-20.04 - - elixir: 1.13.x - otp: 24.x - os: ubuntu-20.04 - - elixir: 1.14.x - otp: 23.x - os: ubuntu-20.04 - - elixir: 1.14.x + - elixir: 1.15.x otp: 24.x - os: ubuntu-20.04 - - elixir: 1.14.x + os: ubuntu-24.04 + - elixir: 1.15.x otp: 25.x - os: ubuntu-20.04 + os: ubuntu-24.04 - elixir: 1.15.x + otp: 26.x + os: ubuntu-24.04 + - elixir: 1.16.x otp: 24.x - os: ubuntu-20.04 - - elixir: 1.15.x + os: ubuntu-24.04 + - elixir: 1.16.x + otp: 25.x + os: ubuntu-24.04 + - elixir: 1.16.x + otp: 26.x + os: ubuntu-24.04 + - elixir: 1.17.x otp: 25.x - os: ubuntu-20.04 - # Something changed in otp 26 for seed and single test started producing failures - # it does not affect functionality, only CI - # - elixir: 1.15.x - # otp: 26.x - # os: ubuntu-20.04 + os: ubuntu-24.04 + - elixir: 1.17.x + otp: 26.x + os: ubuntu-24.04 + - elixir: 1.17.x + otp: 27.x + os: ubuntu-24.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index b6df36843..e65106a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ### Added +- Test with Elixir 1.16 and 1.17 on CI [[@ypconstante](https://github.com/ypconstante)] +- Test with OTP 26 and 27 on CI [[@ypconstante](https://github.com/ypconstante)] + ### Changed ### Deprecated @@ -19,6 +22,7 @@ Change log itself follows [Keep a CHANGELOG](http://keepachangelog.com) format. ### Fixed - Fix compile and runtime warnings on Elixir 1.17 [[@ypconstante](https://github.com/ypconstante)] +- `Faker.Internet.slug` and `Faker.Markdown.markdown/0` results won't change between Elixir versions [[@ypconstante](https://github.com/ypconstante)] ### Security diff --git a/lib/faker.ex b/lib/faker.ex index eebcb74a6..87b264720 100644 --- a/lib/faker.ex +++ b/lib/faker.ex @@ -130,6 +130,14 @@ defmodule Faker do Application.get_env(:faker, :random_module).random_bytes(total) end + @doc """ + Returns a shuffled enum. + """ + @spec shuffle(Enum.t()) :: list() + def shuffle(enum) do + Application.get_env(:faker, :random_module).shuffle(enum) + end + defmacro localize(function) do quote do def unquote(function)() do diff --git a/lib/faker/commerce/hy.ex b/lib/faker/commerce/hy.ex index 3a99aaf7b..74cc62f9f 100644 --- a/lib/faker/commerce/hy.ex +++ b/lib/faker/commerce/hy.ex @@ -13,12 +13,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.color() "մոխրագույն" - iex> Faker.Commerce.Hy.color() - "կանաչ" - iex> Faker.Commerce.Hy.color() - "երկնագույն" - iex> Faker.Commerce.Hy.color() - "մանուշակագույն" """ @spec color() :: String.t() def color do @@ -32,12 +26,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.department() "Համակարգիչներ" - iex> Faker.Commerce.Hy.department() - "Երաժշտություն" - iex> Faker.Commerce.Hy.department() - "Գրքեր" - iex> Faker.Commerce.Hy.department() - "Էլեկտրոնիկա" """ @spec department() :: String.t() sampler(:department, [ @@ -72,12 +60,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.product_name() "հիանալի բրոնզե գլխարկ" - iex> Faker.Commerce.Hy.product_name() - "ֆանտաստիկ դանակ" - iex> Faker.Commerce.Hy.product_name() - "պլաստիկից աթոռ" - iex> Faker.Commerce.Hy.product_name() - "ալյումինե վերնաշապիկ" """ @spec product_name() :: String.t() def product_name, do: product_name(Faker.random_between(0, 2)) @@ -96,12 +78,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.product_name_adjective() "ֆանտաստիկ" - iex> Faker.Commerce.Hy.product_name_adjective() - "հիանալի" - iex> Faker.Commerce.Hy.product_name_adjective() - "միջակ" - iex> Faker.Commerce.Hy.product_name_adjective() - "նրբագեղ" """ @spec product_name_adjective() :: String.t() sampler(:product_name_adjective, [ @@ -130,12 +106,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.product_name_material() "փայտե" - iex> Faker.Commerce.Hy.product_name_material() - "գրանիտե" - iex> Faker.Commerce.Hy.product_name_material() - "բրոնզե" - iex> Faker.Commerce.Hy.product_name_material() - "մարմարե" """ @spec product_name_material() :: String.t() sampler(:product_name_material, [ @@ -165,12 +135,6 @@ defmodule Faker.Commerce.Hy do iex> Faker.Commerce.Hy.product_name_product() "վերնաշապիկ" - iex> Faker.Commerce.Hy.product_name_product() - "ստեղնաշար" - iex> Faker.Commerce.Hy.product_name_product() - "վերնաշապիկ" - iex> Faker.Commerce.Hy.product_name_product() - "գլխարկ" """ @spec product_name_product() :: String.t() sampler(:product_name_product, [ diff --git a/lib/faker/file.ex b/lib/faker/file.ex index bfc99194a..996728134 100644 --- a/lib/faker/file.ex +++ b/lib/faker/file.ex @@ -30,8 +30,8 @@ defmodule Faker.File do ~w(video/mpeg video/mp4 video/ogg video/quicktime video/webm video/x-matroska video/x-ms-wmv video/x-flv) } - @categories_extensions Map.keys(@extensions) - @categories_mimes Map.keys(@mimes) + @categories_extensions @extensions |> Map.keys() |> Enum.sort() + @categories_mimes @mimes |> Map.keys() |> Enum.sort() @doc """ Returns a random file extension @@ -40,12 +40,6 @@ defmodule Faker.File do iex> Faker.File.file_extension() "wav" - iex> Faker.File.file_extension() - "wav" - iex> Faker.File.file_extension() - "doc" - iex> Faker.File.file_extension() - "mov" """ @spec file_extension() :: String.t() def file_extension do @@ -62,12 +56,9 @@ defmodule Faker.File do iex> Faker.File.file_extension(:video) "mov" + iex> Faker.File.file_extension(:image) - "tiff" - iex> Faker.File.file_extension(:audio) - "flac" - iex> Faker.File.file_extension(:office) - "xls" + "bmp" """ @spec file_extension(atom) :: String.t() def file_extension(category) do @@ -83,12 +74,6 @@ defmodule Faker.File do iex> Faker.File.file_name() "aliquam.jpg" - iex> Faker.File.file_name() - "deleniti.doc" - iex> Faker.File.file_name() - "qui.jpg" - iex> Faker.File.file_name() - "quibusdam.csv" """ @spec file_name() :: String.t() def file_name do @@ -105,10 +90,6 @@ defmodule Faker.File do "aliquam.txt" iex> Faker.File.file_name(:video) "sint.mp4" - iex> Faker.File.file_name(:image) - "consequatur.bmp" - iex> Faker.File.file_name(:audio) - "qui.wav" """ @spec file_name(atom) :: String.t() def file_name(category) do @@ -122,12 +103,6 @@ defmodule Faker.File do iex> Faker.File.mime_type() "text/css" - iex> Faker.File.mime_type() - "message/http" - iex> Faker.File.mime_type() - "application/ogg" - iex> Faker.File.mime_type() - "model/x3d+xml" """ @spec mime_type :: String.t() def mime_type do @@ -145,12 +120,6 @@ defmodule Faker.File do iex> Faker.File.mime_type(:image) "image/vnd.microsoft.icon" - iex> Faker.File.mime_type(:audio) - "audio/mp4" - iex> Faker.File.mime_type(:application) - "application/xop+xml" - iex> Faker.File.mime_type(:video) - "video/mpeg" """ @spec mime_type(atom) :: String.t() def mime_type(category) do diff --git a/lib/faker/finance/stock.ex b/lib/faker/finance/stock.ex index 1a252ba09..95ead71bc 100644 --- a/lib/faker/finance/stock.ex +++ b/lib/faker/finance/stock.ex @@ -12,12 +12,6 @@ defmodule Faker.Finance.Stock do iex> Faker.Finance.Stock.ticker() "7401.N225" - iex> Faker.Finance.Stock.ticker() - "4786.HK" - iex> Faker.Finance.Stock.ticker() - "6766.N225" - iex> Faker.Finance.Stock.ticker() - "5166.N225" """ @spec ticker() :: String.t() def ticker do @@ -34,20 +28,9 @@ defmodule Faker.Finance.Stock do iex> Faker.Finance.Stock.ticker(:reuters, :nikkei225) "2110.N225" - iex> Faker.Finance.Stock.ticker(:reuters, :nikkei225) - "7401.N225" - iex> Faker.Finance.Stock.ticker(:reuters, :nikkei225) - "9835.N225" - iex> Faker.Finance.Stock.ticker(:reuters, :nikkei225) - "8304.N225" - iex> Faker.Finance.Stock.ticker(:reuters, :sehk) - "7564.HK" - iex> Faker.Finance.Stock.ticker(:reuters, :sehk) - "3609.HK" - iex> Faker.Finance.Stock.ticker(:reuters, :sehk) - "1085.HK" + iex> Faker.Finance.Stock.ticker(:reuters, :sehk) - "5849.HK" + "8517.HK" """ def ticker(:reuters, :nikkei225) do "#{Faker.random_between(1000, 9999)}.N225" diff --git a/lib/faker/fruit/en.ex b/lib/faker/fruit/en.ex index 4fd5f3c7a..4374966b7 100644 --- a/lib/faker/fruit/en.ex +++ b/lib/faker/fruit/en.ex @@ -8,13 +8,13 @@ defmodule Faker.Fruit.En do @doc """ Returns a fruit. ## Examples - iex> Faker.Fruit.En.fruit + iex> Faker.Fruit.En.fruit() "Kiwano" - iex> Faker.Fruit.En.fruit + iex> Faker.Fruit.En.fruit() "Sugarcane" - iex> Faker.Fruit.En.fruit + iex> Faker.Fruit.En.fruit() "Pineapple" - iex> Faker.Fruit.En.fruit + iex> Faker.Fruit.En.fruit() "Lemon" """ @spec fruit() :: String.t() diff --git a/lib/faker/fruit/pt_br.ex b/lib/faker/fruit/pt_br.ex index 3dfad107e..e83b44c34 100644 --- a/lib/faker/fruit/pt_br.ex +++ b/lib/faker/fruit/pt_br.ex @@ -10,13 +10,13 @@ defmodule Faker.Fruit.PtBr do ## Examples - iex> Faker.Fruit.PtBr.fruit + iex> Faker.Fruit.PtBr.fruit() "Fruta-do-conde" - iex> Faker.Fruit.PtBr.fruit + iex> Faker.Fruit.PtBr.fruit() "Bergamota" - iex> Faker.Fruit.PtBr.fruit + iex> Faker.Fruit.PtBr.fruit() "Quixaba" - iex> Faker.Fruit.PtBr.fruit + iex> Faker.Fruit.PtBr.fruit() "Amora" """ @spec fruit() :: String.t() diff --git a/lib/faker/gov/it.ex b/lib/faker/gov/it.ex index bd58353ad..8b2a1c3e0 100644 --- a/lib/faker/gov/it.ex +++ b/lib/faker/gov/it.ex @@ -13,13 +13,13 @@ defmodule Faker.Gov.It do ## Examples - iex> Faker.Gov.It.fiscal_id + iex> Faker.Gov.It.fiscal_id() "ELRCEA64C50A918F" - iex> Faker.Gov.It.fiscal_id + iex> Faker.Gov.It.fiscal_id() "ZSLNKH22M34H480J" - iex> Faker.Gov.It.fiscal_id + iex> Faker.Gov.It.fiscal_id() "OCPCVO90M50F353I" - iex> Faker.Gov.It.fiscal_id + iex> Faker.Gov.It.fiscal_id() "PQYRFX94R54C681K" """ @spec fiscal_id() :: binary() diff --git a/lib/faker/gov/us.ex b/lib/faker/gov/us.ex index 0a69e2a4c..530720043 100644 --- a/lib/faker/gov/us.ex +++ b/lib/faker/gov/us.ex @@ -8,13 +8,13 @@ defmodule Faker.Gov.Us do ## Examples - iex> Faker.Gov.Us.ssn + iex> Faker.Gov.Us.ssn() "838-84-5749" - iex> Faker.Gov.Us.ssn + iex> Faker.Gov.Us.ssn() "719-41-8674" - iex> Faker.Gov.Us.ssn + iex> Faker.Gov.Us.ssn() "213-54-3766" - iex> Faker.Gov.Us.ssn + iex> Faker.Gov.Us.ssn() "379-09-6851" """ @spec ssn() :: String.t() @@ -37,13 +37,13 @@ defmodule Faker.Gov.Us do ## Examples - iex> Faker.Gov.Us.ein + iex> Faker.Gov.Us.ein() "04-0389586" - iex> Faker.Gov.Us.ein + iex> Faker.Gov.Us.ein() "07-8027034" - iex> Faker.Gov.Us.ein + iex> Faker.Gov.Us.ein() "41-6859447" - iex> Faker.Gov.Us.ein + iex> Faker.Gov.Us.ein() "83-6106581" """ @spec ein() :: String.t() diff --git a/lib/faker/industry.ex b/lib/faker/industry.ex index cc28ab430..784dd1547 100644 --- a/lib/faker/industry.ex +++ b/lib/faker/industry.ex @@ -11,13 +11,13 @@ defmodule Faker.Industry do ## Examples - iex> Faker.Industry.industry + iex> Faker.Industry.industry() "Oil & Gas" - iex> Faker.Industry.industry + iex> Faker.Industry.industry() "Basic Materials" - iex> Faker.Industry.industry + iex> Faker.Industry.industry() "Consumer Services" - iex> Faker.Industry.industry + iex> Faker.Industry.industry() "Health Care" """ @spec industry() :: String.t() @@ -28,13 +28,13 @@ defmodule Faker.Industry do ## Examples - iex> Faker.Industry.super_sector + iex> Faker.Industry.super_sector() "Automobiles & Parts" - iex> Faker.Industry.super_sector + iex> Faker.Industry.super_sector() "Banks" - iex> Faker.Industry.super_sector + iex> Faker.Industry.super_sector() "Automobiles & Parts" - iex> Faker.Industry.super_sector + iex> Faker.Industry.super_sector() "Health Care" """ @spec super_sector() :: String.t() @@ -45,13 +45,13 @@ defmodule Faker.Industry do ## Examples - iex> Faker.Industry.sector + iex> Faker.Industry.sector() "Food & Drug Retailers" - iex> Faker.Industry.sector + iex> Faker.Industry.sector() "Banks" - iex> Faker.Industry.sector + iex> Faker.Industry.sector() "Software & Computer Services" - iex> Faker.Industry.sector + iex> Faker.Industry.sector() "Media" """ @spec sector() :: String.t() diff --git a/lib/faker/industry/en.ex b/lib/faker/industry/en.ex index 4c6cc8203..293cc5c1f 100644 --- a/lib/faker/industry/en.ex +++ b/lib/faker/industry/en.ex @@ -10,13 +10,13 @@ defmodule Faker.Industry.En do ## Examples - iex> Faker.Industry.En.industry + iex> Faker.Industry.En.industry() "Oil & Gas" - iex> Faker.Industry.En.industry + iex> Faker.Industry.En.industry() "Basic Materials" - iex> Faker.Industry.En.industry + iex> Faker.Industry.En.industry() "Consumer Services" - iex> Faker.Industry.En.industry + iex> Faker.Industry.En.industry() "Health Care" """ @spec industry() :: String.t() @@ -38,13 +38,13 @@ defmodule Faker.Industry.En do ## Examples - iex> Faker.Industry.En.super_sector + iex> Faker.Industry.En.super_sector() "Automobiles & Parts" - iex> Faker.Industry.En.super_sector + iex> Faker.Industry.En.super_sector() "Banks" - iex> Faker.Industry.En.super_sector + iex> Faker.Industry.En.super_sector() "Automobiles & Parts" - iex> Faker.Industry.En.super_sector + iex> Faker.Industry.En.super_sector() "Health Care" """ @spec super_sector() :: String.t() @@ -75,13 +75,13 @@ defmodule Faker.Industry.En do ## Examples - iex> Faker.Industry.En.sector + iex> Faker.Industry.En.sector() "Food & Drug Retailers" - iex> Faker.Industry.En.sector + iex> Faker.Industry.En.sector() "Banks" - iex> Faker.Industry.En.sector + iex> Faker.Industry.En.sector() "Software & Computer Services" - iex> Faker.Industry.En.sector + iex> Faker.Industry.En.sector() "Media" """ @spec sector() :: String.t() @@ -136,12 +136,6 @@ defmodule Faker.Industry.En do iex> Faker.Industry.En.sub_sector() "Electrical Components & Equipment" - iex> Faker.Industry.En.sub_sector() - "Publishing" - iex> Faker.Industry.En.sub_sector() - "Alternative Electricity" - iex> Faker.Industry.En.sub_sector() - "Forestry" """ @spec sub_sector() :: String.t() sampler(:sub_sector, [ diff --git a/lib/faker/industry/hy.ex b/lib/faker/industry/hy.ex index 086a77dd5..02734aab9 100644 --- a/lib/faker/industry/hy.ex +++ b/lib/faker/industry/hy.ex @@ -10,13 +10,13 @@ defmodule Faker.Industry.Hy do ## Examples - iex> Faker.Industry.Hy.industry + iex> Faker.Industry.Hy.industry() "Հյուրընկալություն" - iex> Faker.Industry.Hy.industry + iex> Faker.Industry.Hy.industry() "Բժշկական Գործունեություն" - iex> Faker.Industry.Hy.industry + iex> Faker.Industry.Hy.industry() "Վենչուրային և Մասնավոր Կապիտալ" - iex> Faker.Industry.Hy.industry + iex> Faker.Industry.Hy.industry() "Էներգետիկա" """ @spec industry() :: String.t() diff --git a/lib/faker/internet/en.ex b/lib/faker/internet/en.ex index 673245e54..80c58ed8a 100644 --- a/lib/faker/internet/en.ex +++ b/lib/faker/internet/en.ex @@ -12,12 +12,6 @@ defmodule Faker.Internet.En do iex> Faker.Internet.En.free_email_service() "gmail.com" - iex> Faker.Internet.En.free_email_service() - "hotmail.com" - iex> Faker.Internet.En.free_email_service() - "gmail.com" - iex> Faker.Internet.En.free_email_service() - "hotmail.com" """ @spec free_email_service() :: String sampler(:free_email_service, ["gmail.com", "yahoo.com", "hotmail.com"]) @@ -29,12 +23,6 @@ defmodule Faker.Internet.En do iex> Faker.Internet.En.domain_suffix() "com" - iex> Faker.Internet.En.domain_suffix() - "org" - iex> Faker.Internet.En.domain_suffix() - "name" - iex> Faker.Internet.En.domain_suffix() - "info" """ @spec domain_suffix() :: String.t() sampler(:domain_suffix, ["com", "biz", "info", "name", "net", "org"]) diff --git a/lib/faker/internet/es.ex b/lib/faker/internet/es.ex index 3d95ef6ee..77759f1ac 100644 --- a/lib/faker/internet/es.ex +++ b/lib/faker/internet/es.ex @@ -12,12 +12,6 @@ defmodule Faker.Internet.Es do iex> Faker.Internet.Es.free_email_service() "gmail.com" - iex> Faker.Internet.Es.free_email_service() - "hotmail.com" - iex> Faker.Internet.Es.free_email_service() - "gmail.com" - iex> Faker.Internet.Es.free_email_service() - "hotmail.com" """ @spec free_email_service() :: String sampler(:free_email_service, ["gmail.com", "yahoo.com", "hotmail.com"]) @@ -29,12 +23,6 @@ defmodule Faker.Internet.Es do iex> Faker.Internet.Es.domain_suffix() "com" - iex> Faker.Internet.Es.domain_suffix() - "es" - iex> Faker.Internet.Es.domain_suffix() - "com" - iex> Faker.Internet.Es.domain_suffix() - "org" """ @spec domain_suffix() :: String.t() sampler(:domain_suffix, ["com", "es", "info", "com.es", "org"]) diff --git a/lib/faker/internet/hy.ex b/lib/faker/internet/hy.ex index 4d4f4cf63..96fbf438f 100644 --- a/lib/faker/internet/hy.ex +++ b/lib/faker/internet/hy.ex @@ -12,12 +12,6 @@ defmodule Faker.Internet.Hy do iex> Faker.Internet.Hy.free_email_service() "hotmail.com" - iex> Faker.Internet.Hy.free_email_service() - "yandex.ru" - iex> Faker.Internet.Hy.free_email_service() - "freenet.am" - iex> Faker.Internet.Hy.free_email_service() - "yahoo.com" """ @spec free_email_service() :: String sampler(:free_email_service, [ @@ -37,12 +31,6 @@ defmodule Faker.Internet.Hy do iex> Faker.Internet.Hy.domain_suffix() "am" - iex> Faker.Internet.Hy.domain_suffix() - "com" - iex> Faker.Internet.Hy.domain_suffix() - "am" - iex> Faker.Internet.Hy.domain_suffix() - "org" """ @spec domain_suffix() :: String.t() sampler(:domain_suffix, ["am", "com", "info", "net", "org"]) diff --git a/lib/faker/internet/it.ex b/lib/faker/internet/it.ex index ce114f43b..67627ed92 100644 --- a/lib/faker/internet/it.ex +++ b/lib/faker/internet/it.ex @@ -12,12 +12,6 @@ defmodule Faker.Internet.It do iex> Faker.Internet.It.free_email_service() "virgilio.it" - iex> Faker.Internet.It.free_email_service() - "yahoo.it" - iex> Faker.Internet.It.free_email_service() - "aruba.it" - iex> Faker.Internet.It.free_email_service() - "gmail.com" """ @spec free_email_service() :: String.t() sampler(:free_email_service, [ @@ -38,12 +32,6 @@ defmodule Faker.Internet.It do iex> Faker.Internet.It.domain_suffix() "com" - iex> Faker.Internet.It.domain_suffix() - "it" - iex> Faker.Internet.It.domain_suffix() - "com" - iex> Faker.Internet.It.domain_suffix() - "biz" """ @spec domain_suffix() :: String.t() sampler(:domain_suffix, ["com", "it", "info", "org", "biz"]) diff --git a/lib/faker/lorem.ex b/lib/faker/lorem.ex index ea5ab072f..0928dc933 100644 --- a/lib/faker/lorem.ex +++ b/lib/faker/lorem.ex @@ -286,12 +286,15 @@ defmodule Faker.Lorem do iex> Faker.Lorem.characters() ~c'ppkQqaIfGqxsjFoNITNnu6eXyJicLJNth88PrhGDhwp4LNQMt5pCFh7XGEZUiBOjqwcnSUTH94vu8a9XKUwNAs48lHzPITbFXSfTS0pHfBSmHkbj9kOsd7qRuGeXKTgCgI1idI3uwENwTqc' + iex> Faker.Lorem.characters(3..5) - ~c'EFbv' + ~c'ppk' + iex> Faker.Lorem.characters(2) - ~c'vx' + ~c'Ap' + iex> Faker.Lorem.characters(7) - ~c'jycADSd' + ~c'AppkQqa' """ @spec characters(integer | Range.t()) :: [char] def characters(range_or_length \\ 15..255) @@ -353,13 +356,25 @@ defmodule Faker.Lorem do ## Examples iex> Faker.Lorem.paragraphs() - ["Consequatur et qui vitae? Et sit aut expedita cumque est necessitatibus beatae ex. Possimus soluta asperiores qui vitae.", "Et vitae vitae ut quisquam corporis quisquam ab harum ipsa. Numquam maxime ut aut inventore eius rerum beatae. Qui officia vel quaerat expedita. Perspiciatis rerum nam repellendus inventore nihil. Sequi ducimus qui voluptates magni quisquam sed odio.", "Error non impedit tempora minus voluptatem qui fugit. Ab consectetur harum earum possimus. Provident quisquam modi accusantium eligendi numquam illo voluptas. Est non id quibusdam qui omnis?", "Dicta dolores at ut delectus magni atque eos beatae nulla. Laudantium qui dolorem pariatur voluptatibus sed et enim?"] + [ + "Consequatur et qui vitae? Et sit aut expedita cumque est necessitatibus beatae ex. Possimus soluta asperiores qui vitae.", + "Et vitae vitae ut quisquam corporis quisquam ab harum ipsa. Numquam maxime ut aut inventore eius rerum beatae. Qui officia vel quaerat expedita. Perspiciatis rerum nam repellendus inventore nihil. Sequi ducimus qui voluptates magni quisquam sed odio.", + "Error non impedit tempora minus voluptatem qui fugit. Ab consectetur harum earum possimus. Provident quisquam modi accusantium eligendi numquam illo voluptas. Est non id quibusdam qui omnis?", + "Dicta dolores at ut delectus magni atque eos beatae nulla. Laudantium qui dolorem pariatur voluptatibus sed et enim?" + ] iex> Faker.Lorem.paragraphs(2..3) - ["Voluptate reiciendis repellat et praesentium quia sed nemo. Vero repellat cumque nihil similique repudiandae corrupti rerum? Accusamus suscipit perspiciatis cum et sint dolore et ut. Eos reprehenderit cupiditate omnis et doloremque omnis.", "Quo et est culpa eum ex et veniam aut aut! Labore fuga tenetur alias est provident?", "Illo consequatur maiores illum et quia culpa sunt! Cumque porro ut eum porro est id maxime dolorum animi. Deserunt ipsa consequuntur eveniet asperiores. Quia numquam voluptas vitae repellat tempore."] + [ + "Voluptate reiciendis repellat et praesentium quia sed nemo. Vero repellat cumque nihil similique repudiandae corrupti rerum? Accusamus suscipit perspiciatis cum et sint dolore et ut. Eos reprehenderit cupiditate omnis et doloremque omnis.", + "Quo et est culpa eum ex et veniam aut aut! Labore fuga tenetur alias est provident?", + "Illo consequatur maiores illum et quia culpa sunt! Cumque porro ut eum porro est id maxime dolorum animi. Deserunt ipsa consequuntur eveniet asperiores. Quia numquam voluptas vitae repellat tempore." + ] iex> Faker.Lorem.paragraphs(1) ["Voluptas harum modi omnis quam dolor a aliquam officiis. Neque voluptas consequatur sed cupiditate dolorum pariatur et."] iex> Faker.Lorem.paragraphs(2) - ["Voluptatem natus amet eius eos non dolorum quaerat dolores pariatur. Aliquam rerum ab voluptatem exercitationem nobis enim delectus tempore eos. Ex enim dolore ut consequuntur eaque expedita dicta eius totam. A eveniet ab magni rerum enim consequatur.", "Nihil laudantium ea veniam necessitatibus qui. Minus ad omnis quaerat quidem impedit sint. Id ut repellat qui repudiandae!"] + [ + "Voluptatem natus amet eius eos non dolorum quaerat dolores pariatur. Aliquam rerum ab voluptatem exercitationem nobis enim delectus tempore eos. Ex enim dolore ut consequuntur eaque expedita dicta eius totam. A eveniet ab magni rerum enim consequatur.", + "Nihil laudantium ea veniam necessitatibus qui. Minus ad omnis quaerat quidem impedit sint. Id ut repellat qui repudiandae!" + ] """ @spec paragraphs(integer | Range.t()) :: list(String.t()) def paragraphs(range \\ 2..5) @@ -392,10 +407,6 @@ defmodule Faker.Lorem do "Sint deleniti consequatur et qui vitae et quibusdam et sit." iex> Faker.Lorem.sentence(2..3) "Cumque est?" - iex> Faker.Lorem.sentence(3) - "Beatae ex sunt." - iex> Faker.Lorem.sentence(5) - "Possimus soluta asperiores qui vitae." """ @spec sentence(integer | Range.t()) :: String.t() def sentence(range \\ 4..10) @@ -418,12 +429,6 @@ defmodule Faker.Lorem do iex> Faker.Lorem.sentence(7, "...") "Aliquam ut sint deleniti consequatur et qui..." - iex> Faker.Lorem.sentence(1, "?") - "Vitae?" - iex> Faker.Lorem.sentence(5, ".") - "Et quibusdam et sit aut." - iex> Faker.Lorem.sentence(3, ";") - "Expedita cumque est;" """ @spec sentence(integer, binary) :: String.t() def sentence(num, mark) when is_integer(num) and is_binary(mark) do @@ -447,13 +452,32 @@ defmodule Faker.Lorem do ## Examples iex> Faker.Lorem.sentences() - ["Deleniti consequatur et qui vitae et.", "Sit aut expedita cumque est necessitatibus beatae ex sunt!", "Soluta asperiores qui vitae animi et id et vitae.", "Quisquam corporis quisquam ab harum!"] + [ + "Deleniti consequatur et qui vitae et.", + "Sit aut expedita cumque est necessitatibus beatae ex sunt!", + "Soluta asperiores qui vitae animi et id et vitae.", + "Quisquam corporis quisquam ab harum!" + ] iex> Faker.Lorem.sentences(3..4) - ["Numquam maxime ut aut inventore eius rerum beatae.", "Qui officia vel quaerat expedita.", "Perspiciatis rerum nam repellendus inventore nihil.", "Sequi ducimus qui voluptates magni quisquam sed odio."] + [ + "Numquam maxime ut aut inventore eius rerum beatae.", + "Qui officia vel quaerat expedita.", + "Perspiciatis rerum nam repellendus inventore nihil.", + "Sequi ducimus qui voluptates magni quisquam sed odio." + ] iex> Faker.Lorem.sentences(4) - ["Vel error non impedit tempora minus.", "Fugit cupiditate fuga ab consectetur harum earum possimus totam.", "Quisquam modi accusantium eligendi numquam.", "Quod blanditiis est non id quibusdam qui omnis alias!"] + [ + "Vel error non impedit tempora minus.", + "Fugit cupiditate fuga ab consectetur harum earum possimus totam.", + "Quisquam modi accusantium eligendi numquam.", + "Quod blanditiis est non id quibusdam qui omnis alias!" + ] iex> Faker.Lorem.sentences(3) - ["Dicta dolores at ut delectus magni atque eos beatae nulla.", "Laudantium qui dolorem pariatur voluptatibus sed et enim?", "Minima laudantium voluptate reiciendis repellat."] + [ + "Dicta dolores at ut delectus magni atque eos beatae nulla.", + "Laudantium qui dolorem pariatur voluptatibus sed et enim?", + "Minima laudantium voluptate reiciendis repellat." + ] """ @spec sentences(integer | Range.t()) :: [String.t()] def sentences(range \\ 2..5) diff --git a/lib/faker/lorem/shakespeare/en.ex b/lib/faker/lorem/shakespeare/en.ex index 9abf937e9..6bee94d2a 100644 --- a/lib/faker/lorem/shakespeare/en.ex +++ b/lib/faker/lorem/shakespeare/en.ex @@ -74,12 +74,6 @@ defmodule Faker.Lorem.Shakespeare.En do iex> Faker.Lorem.Shakespeare.En.king_richard_iii() "The king's name is a tower of strength." - iex> Faker.Lorem.Shakespeare.En.king_richard_iii() - "A horse! a horse! my kingdom for a horse!" - iex> Faker.Lorem.Shakespeare.En.king_richard_iii() - "So wise so young, they say, do never live long." - iex> Faker.Lorem.Shakespeare.En.king_richard_iii() - "Now is the winter of our discontent." """ @spec king_richard_iii() :: String.t() sampler(:king_richard_iii, [ @@ -100,12 +94,6 @@ defmodule Faker.Lorem.Shakespeare.En do iex> Faker.Lorem.Shakespeare.En.romeo_and_juliet() "What's in a name? That which we call a rose by any other name would smell as sweet." - iex> Faker.Lorem.Shakespeare.En.romeo_and_juliet() - "For you and I are past our dancing days." - iex> Faker.Lorem.Shakespeare.En.romeo_and_juliet() - "For you and I are past our dancing days." - iex> Faker.Lorem.Shakespeare.En.romeo_and_juliet() - "For you and I are past our dancing days." """ @spec romeo_and_juliet() :: String.t() sampler(:romeo_and_juliet, [ diff --git a/lib/faker/lorem/shakespeare/ru.ex b/lib/faker/lorem/shakespeare/ru.ex index 22405462e..e7242b0c3 100644 --- a/lib/faker/lorem/shakespeare/ru.ex +++ b/lib/faker/lorem/shakespeare/ru.ex @@ -12,12 +12,6 @@ defmodule Faker.Lorem.Shakespeare.Ru do iex> Faker.Lorem.Shakespeare.Ru.hamlet() "И дальше тишина." - iex> Faker.Lorem.Shakespeare.Ru.hamlet() - "Быть иль не быть, вот в чём вопрос." - iex> Faker.Lorem.Shakespeare.Ru.hamlet() - "Быть иль не быть, вот в чём вопрос." - iex> Faker.Lorem.Shakespeare.Ru.hamlet() - "Быть иль не быть, вот в чём вопрос." """ @spec hamlet() :: String.t() sampler(:hamlet, [ @@ -41,12 +35,6 @@ defmodule Faker.Lorem.Shakespeare.Ru do iex> Faker.Lorem.Shakespeare.Ru.as_you_like_it() "Дурак думает, что он умен; умный же знает, что глуп он." - iex> Faker.Lorem.Shakespeare.Ru.as_you_like_it() - "Весь мир — театр. В нем женщины, мужчины — все актеры. У них свои есть выходы, уходы, и каждый не одну играет роль." - iex> Faker.Lorem.Shakespeare.Ru.as_you_like_it() - "Весь мир — театр. В нем женщины, мужчины — все актеры. У них свои есть выходы, уходы, и каждый не одну играет роль." - iex> Faker.Lorem.Shakespeare.Ru.as_you_like_it() - "Дурак думает, что он умен; умный же знает, что глуп он." """ @spec as_you_like_it() :: String.t() sampler(:as_you_like_it, [ @@ -61,12 +49,6 @@ defmodule Faker.Lorem.Shakespeare.Ru do iex> Faker.Lorem.Shakespeare.Ru.king_richard_iii() "Коня, коня! Престол мой за коня!" - iex> Faker.Lorem.Shakespeare.Ru.king_richard_iii() - "Нет, не купить любви ценой злодейств!" - iex> Faker.Lorem.Shakespeare.Ru.king_richard_iii() - "Нет, не купить любви ценой злодейств!" - iex> Faker.Lorem.Shakespeare.Ru.king_richard_iii() - "Коня, коня! Престол мой за коня!" """ @spec king_richard_iii() :: String.t() sampler(:king_richard_iii, [ @@ -81,12 +63,6 @@ defmodule Faker.Lorem.Shakespeare.Ru do iex> Faker.Lorem.Shakespeare.Ru.romeo_and_juliet() "Нет повести печальнее на свете, чем повесть о Ромео и Джульетте." - iex> Faker.Lorem.Shakespeare.Ru.romeo_and_juliet() - "Картина требует красивой рамы, и золотое содержанье книг, нуждается в обложках золотых." - iex> Faker.Lorem.Shakespeare.Ru.romeo_and_juliet() - "Чем лучше цель, тем целимся мы метче." - iex> Faker.Lorem.Shakespeare.Ru.romeo_and_juliet() - "В минуты отчаянья сойдёт за вечность час..." """ @spec romeo_and_juliet() :: String.t() sampler(:romeo_and_juliet, [ diff --git a/lib/faker/markdown.ex b/lib/faker/markdown.ex index 53700ab53..04355bbeb 100644 --- a/lib/faker/markdown.ex +++ b/lib/faker/markdown.ex @@ -1,10 +1,10 @@ defmodule Faker.Markdown do - import Faker, only: [random_between: 2] + import Faker, only: [random_between: 2, random_uniform: 0] alias Faker.Lorem alias Faker.Util - @moduledoc """ + @moduledoc ~S""" Functions for generating random markdown """ @@ -12,7 +12,7 @@ defmodule Faker.Markdown do @emphasis ["_", "~", "*", "**"] @langs ["elixir", "erlang", "ruby", "go", "shell"] - @doc """ + @doc ~S""" Returns a random markdown header ## Examples @@ -34,7 +34,7 @@ defmodule Faker.Markdown do "#{Util.pick(@headers)} #{header}" end - @doc """ + @doc ~S""" Returns a random sentence with random emphasis word ## Examples @@ -60,7 +60,7 @@ defmodule Faker.Markdown do |> Enum.join(" ") end - @doc """ + @doc ~S""" Returns a random ordered list ## Examples @@ -70,16 +70,16 @@ defmodule Faker.Markdown do iex> Faker.Markdown.ordered_list() "1. Aut expedita cumque est necessitatibus beatae ex sunt!" iex> Faker.Markdown.ordered_list() - "1. Asperiores qui vitae animi et id et vitae vitae.\\n2. Corporis quisquam ab harum ipsa sed veritatis.\\n3. Ut aut inventore eius!\\n4. Aut doloribus qui officia vel quaerat.\\n5. Et perspiciatis rerum nam repellendus inventore nihil dicta ipsum.\\n6. Qui voluptates magni quisquam sed odio accusamus et.\\n7. Non impedit tempora minus voluptatem qui fugit?\\n8. Ab consectetur harum earum possimus." + "1. Asperiores qui vitae animi et id et vitae vitae.\n2. Corporis quisquam ab harum ipsa sed veritatis.\n3. Ut aut inventore eius!\n4. Aut doloribus qui officia vel quaerat.\n5. Et perspiciatis rerum nam repellendus inventore nihil dicta ipsum.\n6. Qui voluptates magni quisquam sed odio accusamus et.\n7. Non impedit tempora minus voluptatem qui fugit?\n8. Ab consectetur harum earum possimus." iex> Faker.Markdown.ordered_list() - "1. Quisquam modi accusantium eligendi numquam.\\n2. Quod blanditiis est non id quibusdam qui omnis alias!\\n3. Dicta dolores at ut delectus magni atque eos beatae nulla.\\n4. Laudantium qui dolorem pariatur voluptatibus sed et enim?" + "1. Quisquam modi accusantium eligendi numquam.\n2. Quod blanditiis est non id quibusdam qui omnis alias!\n3. Dicta dolores at ut delectus magni atque eos beatae nulla.\n4. Laudantium qui dolorem pariatur voluptatibus sed et enim?" """ @spec ordered_list() :: String.t() def ordered_list do list() end - @doc """ + @doc ~S""" Returns a random unordered list ## Examples @@ -89,9 +89,9 @@ defmodule Faker.Markdown do iex> Faker.Markdown.unordered_list() "* Aut expedita cumque est necessitatibus beatae ex sunt!" iex> Faker.Markdown.unordered_list() - "* Asperiores qui vitae animi et id et vitae vitae.\\n* Corporis quisquam ab harum ipsa sed veritatis.\\n* Ut aut inventore eius!\\n* Aut doloribus qui officia vel quaerat.\\n* Et perspiciatis rerum nam repellendus inventore nihil dicta ipsum.\\n* Qui voluptates magni quisquam sed odio accusamus et.\\n* Non impedit tempora minus voluptatem qui fugit?\\n* Ab consectetur harum earum possimus." + "* Asperiores qui vitae animi et id et vitae vitae.\n* Corporis quisquam ab harum ipsa sed veritatis.\n* Ut aut inventore eius!\n* Aut doloribus qui officia vel quaerat.\n* Et perspiciatis rerum nam repellendus inventore nihil dicta ipsum.\n* Qui voluptates magni quisquam sed odio accusamus et.\n* Non impedit tempora minus voluptatem qui fugit?\n* Ab consectetur harum earum possimus." iex> Faker.Markdown.unordered_list() - "* Quisquam modi accusantium eligendi numquam.\\n* Quod blanditiis est non id quibusdam qui omnis alias!\\n* Dicta dolores at ut delectus magni atque eos beatae nulla.\\n* Laudantium qui dolorem pariatur voluptatibus sed et enim?" + "* Quisquam modi accusantium eligendi numquam.\n* Quod blanditiis est non id quibusdam qui omnis alias!\n* Dicta dolores at ut delectus magni atque eos beatae nulla.\n* Laudantium qui dolorem pariatur voluptatibus sed et enim?" """ @spec unordered_list() :: String.t() def unordered_list do @@ -110,7 +110,7 @@ defmodule Faker.Markdown do |> Enum.join("\n") end - @doc """ + @doc ~S""" Returns random inline code ## Examples @@ -129,19 +129,19 @@ defmodule Faker.Markdown do "`#{Lorem.sentence()}`" end - @doc """ + @doc ~S""" Returns random inline code ## Examples iex> Faker.Markdown.block_code() - "```elixir\\nDeleniti consequatur et qui vitae et.\\n```" + "```elixir\nDeleniti consequatur et qui vitae et.\n```" iex> Faker.Markdown.block_code() - "```elixir\\nAut expedita cumque est necessitatibus beatae ex sunt!\\n```" + "```elixir\nAut expedita cumque est necessitatibus beatae ex sunt!\n```" iex> Faker.Markdown.block_code() - "```ruby\\nAsperiores qui vitae animi et id et vitae vitae.\\n```" + "```ruby\nAsperiores qui vitae animi et id et vitae vitae.\n```" iex> Faker.Markdown.block_code() - "```go\\nQuisquam ab harum ipsa sed veritatis numquam.\\n```" + "```go\nQuisquam ab harum ipsa sed veritatis numquam.\n```" """ @spec block_code() :: String.t() def block_code do @@ -152,19 +152,19 @@ defmodule Faker.Markdown do """ end - @doc """ + @doc ~S""" Returns random markdown table ## Examples iex> Faker.Markdown.table() - "sint | deleniti | consequatur\\n---- | ---- | ----\\net | qui | vitae\\net | quibusdam | et\\nsit | aut | expedita\\ncumque | est | necessitatibus\\nbeatae | ex | sunt" + "sint | deleniti | consequatur\n---- | ---- | ----\net | qui | vitae\net | quibusdam | et\nsit | aut | expedita\ncumque | est | necessitatibus\nbeatae | ex | sunt" iex> Faker.Markdown.table() - "soluta | asperiores\\n---- | ----\\nqui | vitae\\nanimi | et\\nid | et\\nvitae | vitae\\nut | quisquam\\ncorporis | quisquam" + "soluta | asperiores\n---- | ----\nqui | vitae\nanimi | et\nid | et\nvitae | vitae\nut | quisquam\ncorporis | quisquam" iex> Faker.Markdown.table() - "ipsa | sed | veritatis | numquam | maxime\\n---- | ---- | ---- | ---- | ----\\nut | aut | inventore | eius | rerum\\nbeatae | aut | doloribus | qui | officia\\nvel | quaerat | expedita | ut | et\\nperspiciatis | rerum | nam | repellendus | inventore" + "ipsa | sed | veritatis | numquam | maxime\n---- | ---- | ---- | ---- | ----\nut | aut | inventore | eius | rerum\nbeatae | aut | doloribus | qui | officia\nvel | quaerat | expedita | ut | et\nperspiciatis | rerum | nam | repellendus | inventore" iex> Faker.Markdown.table() - "ipsum | sequi | ducimus | qui | voluptates\\n---- | ---- | ---- | ---- | ----\\nmagni | quisquam | sed | odio | accusamus\\net | vel | error | non | impedit\\ntempora | minus | voluptatem | qui | fugit" + "ipsum | sequi | ducimus | qui | voluptates\n---- | ---- | ---- | ---- | ----\nmagni | quisquam | sed | odio | accusamus\net | vel | error | non | impedit\ntempora | minus | voluptatem | qui | fugit" """ @spec table() :: String.t() def table do @@ -185,19 +185,19 @@ defmodule Faker.Markdown do |> Enum.join("\n") end - @doc """ + @doc ~S""" Returns random markdown ## Examples iex> Faker.Markdown.markdown() - "cumque | est | necessitatibus\\n---- | ---- | ----\\nbeatae | ex | sunt\\nsoluta | possimus | soluta\\nasperiores | qui | vitae\\n\\n* Et vitae vitae ut quisquam corporis quisquam ab harum ipsa.\\n* Numquam maxime ut aut inventore eius rerum beatae.\\n* Qui officia vel quaerat expedita.\\n* Perspiciatis rerum nam repellendus inventore nihil.\\n\\n`Sequi ducimus qui voluptates magni quisquam sed odio.`\\n\\n```elixir\\nError non impedit tempora minus voluptatem qui fugit.\\n```\\n\\n### Cupiditate" + "## Aut\n\n```ruby\nBeatae ex sunt soluta possimus soluta asperiores qui vitae animi.\n```\n\n`Et vitae vitae ut quisquam corporis quisquam ab harum ipsa.`\n\n* Maxime ut aut inventore eius rerum beatae?\n* Qui officia vel quaerat expedita.\n* Perspiciatis rerum nam repellendus inventore nihil.\n* Sequi ducimus qui voluptates magni quisquam sed odio.\n* Vel error non impedit tempora minus.\n\nfugit | cupiditate | fuga | ab\n---- | ---- | ---- | ----\nconsectetur | harum | earum | possimus\ntotam | nobis | provident | quisquam\nmodi | accusantium | eligendi | numquam" iex> Faker.Markdown.markdown() - "_Illo_ voluptas quod blanditiis est non id quibusdam qui omnis. Odit dicta dolores at ut delectus magni atque eos? Labore voluptate laudantium qui.\\n\\n### Voluptatibus\\n\\nullam | similique | minima | laudantium\\n---- | ---- | ---- | ----\\nvoluptate | reiciendis | repellat | et\\npraesentium | quia | sed | nemo\\nminus | ea | vero | repellat\\ncumque | nihil | similique | repudiandae\\ncorrupti | rerum | sed | similique\\naccusamus | suscipit | perspiciatis | cum" + "Odit dicta dolores at ut delectus magni atque eos? Labore voluptate laudantium ~qui.~ Voluptatibus sed et enim ullam?\n\n1. Repellat et praesentium quia sed nemo minus ea!\n2. Cumque nihil similique repudiandae corrupti!\n3. Similique accusamus suscipit perspiciatis cum.\n4. Dolore et ut earum possimus eos reprehenderit cupiditate omnis et.\n5. Sit delectus possimus quo et est culpa eum ex?\n6. Aut aut aut quisquam?\n7. Tenetur alias est provident esse dicta ea illo consequatur maiores?" iex> Faker.Markdown.markdown() - "```erlang\\nSit delectus possimus quo et est culpa eum ex?\\n```\\n\\n1. Aut aut quisquam labore fuga tenetur alias.\\n2. Esse dicta ea illo consequatur!\\n3. Et quia culpa sunt sit eius cumque porro ut eum.\\n4. Id maxime dolorum animi!\\n5. Deserunt ipsa consequuntur eveniet asperiores.\\n6. Quia numquam voluptas vitae repellat tempore.\\n7. Harum voluptas harum modi omnis quam dolor a aliquam officiis?\\n8. Neque voluptas consequatur sed cupiditate dolorum pariatur et.\\n9. Aut voluptatem natus amet eius eos non dolorum.\\n\\n`Pariatur ex illo aliquam rerum ab voluptatem exercitationem nobis enim.`\\n\\nCorporis **unde** ex enim dolore ut consequuntur eaque! Eius totam nobis est." + "* Porro est id maxime dolorum animi.\n* Deserunt ipsa consequuntur eveniet asperiores.\n* Quia numquam voluptas vitae repellat tempore.\n* Harum voluptas harum modi omnis quam dolor a aliquam officiis?\n* Neque voluptas consequatur sed cupiditate dolorum pariatur et.\n* Aut voluptatem natus amet eius eos non dolorum.\n* Pariatur ex illo aliquam rerum ab voluptatem exercitationem nobis enim.\n* Eos corporis unde ex enim dolore ut consequuntur.\n* Dicta eius totam nobis est a eveniet ab magni.\n* Consequatur unde dolorem et nihil laudantium ea veniam necessitatibus." iex> Faker.Markdown.markdown() - "Qui iusto quisquam minus ad omnis quaerat quidem _impedit!_ Qui id ut repellat qui repudiandae quia cumque excepturi laudantium.\\n\\n`Non consequatur molestiae laboriosam sit!`\\n\\n## Aperiam" + "1. Repellat qui repudiandae quia cumque excepturi laudantium accusantium!\n2. Sunt non consequatur molestiae laboriosam sit aperiam.\n3. Voluptatem est beatae delectus minus qui molestiae dolorem aut.\n4. Iure enim sapiente quia voluptas esse!\n\n```go\nVoluptas ullam ratione et esse optio qui ut sed dignissimos!\n```\n\nsaepe | a | illo\n---- | ---- | ----\nut | eos | aliquid\nquisquam | omnis | magni\nconsequuntur | molestiae | expedita\n\n* Ducimus est nulla repellat reiciendis est est veritatis.\n* Quaerat assumenda ut reiciendis eaque in!\n* Aliquam quis sapiente facere?\n* Nihil suscipit pariatur qui." """ @spec markdown() :: String.t() def markdown do @@ -213,7 +213,7 @@ defmodule Faker.Markdown do |> Enum.filter(fn _ -> Util.pick([true, false]) end) - |> Enum.shuffle() + |> Enum.sort_by(fn _ -> random_uniform() end) |> Stream.map(fn fun -> apply(__MODULE__, fun, []) end) diff --git a/lib/faker/name.ex b/lib/faker/name.ex index b8a2206b9..4ee61ad1b 100644 --- a/lib/faker/name.ex +++ b/lib/faker/name.ex @@ -12,12 +12,6 @@ defmodule Faker.Name do iex> Faker.Name.name() "Mrs. Abe Rolfson MD" - iex> Faker.Name.name() - "Conor Padberg" - iex> Faker.Name.name() - "Mr. Bianka Ryan" - iex> Faker.Name.name() - "Ally Rau MD" """ @deprecated "Use Faker.Person.name/0 instead." @spec name() :: String.t() @@ -30,12 +24,6 @@ defmodule Faker.Name do iex> Faker.Name.first_name() "Joany" - iex> Faker.Name.first_name() - "Elizabeth" - iex> Faker.Name.first_name() - "Abe" - iex> Faker.Name.first_name() - "Ozella" """ @deprecated "Use Faker.Person.first_name/0 instead." @spec first_name() :: String.t() @@ -48,12 +36,6 @@ defmodule Faker.Name do iex> Faker.Name.last_name() "Blick" - iex> Faker.Name.last_name() - "Hayes" - iex> Faker.Name.last_name() - "Schumm" - iex> Faker.Name.last_name() - "Rolfson" """ @deprecated "Use Faker.Person.last_name/0 instead." @spec last_name() :: String.t() @@ -66,12 +48,6 @@ defmodule Faker.Name do iex> Faker.Name.title() "Dynamic Identity Administrator" - iex> Faker.Name.title() - "Product Communications Technician" - iex> Faker.Name.title() - "Legacy Accountability Architect" - iex> Faker.Name.title() - "Customer Data Representative" """ @deprecated "Use Faker.Person.title/0 instead." @spec title() :: String.t() @@ -84,12 +60,6 @@ defmodule Faker.Name do iex> Faker.Name.suffix() "II" - iex> Faker.Name.suffix() - "V" - iex> Faker.Name.suffix() - "V" - iex> Faker.Name.suffix() - "V" """ @deprecated "Use Faker.Person.suffix/0 instead." @spec suffix() :: String.t() @@ -102,12 +72,6 @@ defmodule Faker.Name do iex> Faker.Name.prefix() "Mr." - iex> Faker.Name.prefix() - "Mrs." - iex> Faker.Name.prefix() - "Mr." - iex> Faker.Name.prefix() - "Dr." """ @deprecated "Use Faker.Person.prefix/0 instead." @spec prefix() :: String.t() diff --git a/lib/faker/person/fr.ex b/lib/faker/person/fr.ex index 31c8cf010..6ce0fd4a6 100644 --- a/lib/faker/person/fr.ex +++ b/lib/faker/person/fr.ex @@ -32,7 +32,7 @@ defmodule Faker.Person.Fr do Returns a random first name ## Examples - + iex> Faker.Person.Fr.first_name() "Damien" iex> Faker.Person.Fr.first_name() @@ -292,7 +292,7 @@ defmodule Faker.Person.Fr do Returns a random prefix ## Examples - + iex> Faker.Person.Fr.prefix() "Docteur" iex> Faker.Person.Fr.prefix() @@ -333,5 +333,3 @@ defmodule Faker.Person.Fr do "PhD" ]) end - -# Faker.Person.Fr diff --git a/lib/faker/phone/en_gb.ex b/lib/faker/phone/en_gb.ex index 643d015a7..5da9c86b7 100644 --- a/lib/faker/phone/en_gb.ex +++ b/lib/faker/phone/en_gb.ex @@ -31,13 +31,13 @@ defmodule Faker.Phone.EnGb do ## Examples iex> Faker.Phone.EnGb.number() - "+44054264610" + "+44042646108" iex> Faker.Phone.EnGb.number() - "+44562970523" + "07897 052357" iex> Faker.Phone.EnGb.number() - "+447502 030320" + "+44803032097" iex> Faker.Phone.EnGb.number() - "+447933 760337" + "+447776 033745" """ @spec number() :: String.t() def number do @@ -54,13 +54,13 @@ defmodule Faker.Phone.EnGb do ## Examples iex> Faker.Phone.EnGb.landline_number() - "+44331542646" + "+44335426461" iex> Faker.Phone.EnGb.landline_number() - "+44560832970" + "+44343297052" iex> Faker.Phone.EnGb.landline_number() - "+44023570203" + "+44567020303" iex> Faker.Phone.EnGb.landline_number() - "+44703209733" + "+44709733760" """ @spec landline_number() :: String.t() def landline_number do diff --git a/lib/faker/phone/pt_br.ex b/lib/faker/phone/pt_br.ex index 4141d9d8e..49ba01288 100644 --- a/lib/faker/phone/pt_br.ex +++ b/lib/faker/phone/pt_br.ex @@ -30,6 +30,7 @@ defmodule Faker.Phone.PtBr do Replace 'xx' for a random region number picked. ## Examples + iex> Faker.Phone.PtBr.number_with_region("(xx) 9 1542-6461") "(92) 9 1542-6461" iex> Faker.Phone.PtBr.number_with_region("(xx) 4329-7052") @@ -51,6 +52,7 @@ defmodule Faker.Phone.PtBr do Pick a random region code from list ## Examples + iex> Faker.Phone.PtBr.generate_region_code() "92" iex> Faker.Phone.PtBr.generate_region_code() diff --git a/lib/faker/pizza.ex b/lib/faker/pizza.ex index 381f5cb95..402c4238a 100644 --- a/lib/faker/pizza.ex +++ b/lib/faker/pizza.ex @@ -18,26 +18,26 @@ defmodule Faker.Pizza do iex> Faker.Pizza.pizzas() [ - "14\\" Greek Maltija", + "14\\" Greek Fajita", "Large with Reindeer, Buffalo Chicken, Egg, Chorizo, and Clam", - "9\\" Capricciosa", - "9\\" Sicilian Style Frutti di mare" + "9\\" Kebab", + "9\\" Sicilian Style Buffalo Chicken" ] iex> Faker.Pizza.pizzas(2..3) [ - "12\\" Fajita", - "Medium Fajita" + "12\\" Quattro Formaggio", + "Medium Pesto Chicken" ] iex> Faker.Pizza.pizzas(3..4) [ "Large Gluten-Free Corn with Oysters, Bacon, and Steak", - "10\\" Flatbread Grilled Vegetarian", - "30\\" Thai Chicken", + "10\\" Flatbread Pesto Chicken", + "30\\" Funghi", "Small with Sauerkraut" ] iex> Faker.Pizza.pizzas(5) [ - "Large Quattro Formaggio", + "Large Cheese", "Small Sweet Potato Crust with Mackerel, Jalapeños, Smoked Mozzarella, and Smoked Salmon", "30\\" with Pickled Ginger, Meatballs, Goat Cheese, Prosciutto, and Pineapple", "9\\" Detroit-style with Steak", @@ -68,9 +68,9 @@ defmodule Faker.Pizza do iex> Faker.Pizza.pizza() "Medium New York Style with Clam and Reindeer" iex> Faker.Pizza.pizza() - "9\\" Supreme" + "9\\" Africana" iex> Faker.Pizza.pizza() - "16\\" Shrimp Club" + "16\\" Meat Lovers" """ @spec pizza() :: String.t() def pizza, do: pizza(Faker.random_between(1, 30)) @@ -450,11 +450,11 @@ defmodule Faker.Pizza do ## Examples iex> Faker.Pizza.combo() - "Breakfast" + "Hot & Spicy" iex> Faker.Pizza.combo() - "Caprese" + "Breakfast" iex> Faker.Pizza.combo() - "Mockba" + "Thai Chicken" iex> Faker.Pizza.combo() "Poutine" """ @@ -462,16 +462,15 @@ defmodule Faker.Pizza do sampler(:combo, [ "Africana", "All Dressed", - "Bacon Cheeseburger ", + "Bacon Cheeseburger", "BBQ Chicken", - "Bianca ", + "Bianca", "Bolognese", "Breakfast", "Buffalo Chicken", "Canadian", "Caprese", "Capricciosa", - "Capricciosa ", "Cheese", "Chicken Pesto", "Ciao-ciao", @@ -494,7 +493,7 @@ defmodule Faker.Pizza do "Margherita", "Meat Feast", "Meat Lovers", - "Meatball ", + "Meatball", "Mockba", "Onion & Gorgonzola", "Pepperoni & Mushroom", diff --git a/lib/faker/random.ex b/lib/faker/random.ex index 982eaec68..17f707ff3 100644 --- a/lib/faker/random.ex +++ b/lib/faker/random.ex @@ -3,9 +3,10 @@ defmodule Faker.Random do Behaviour that defines randomisation in faker. """ - @callback random_between(integer, integer) :: integer - @callback random_bytes(pos_integer) :: binary - @callback random_uniform() :: float + @callback random_between(integer(), integer()) :: integer() + @callback random_bytes(pos_integer()) :: binary() + @callback random_uniform() :: float() + @callback shuffle(Enum.t()) :: list() defmacro __using__(_) do quote do @@ -23,7 +24,11 @@ defmodule Faker.Random do :rand.uniform() end - defoverridable random_between: 2, random_bytes: 1, random_uniform: 0 + def shuffle(enum) do + Enum.shuffle(enum) + end + + defoverridable random_between: 2, random_bytes: 1, random_uniform: 0, shuffle: 1 end end end diff --git a/lib/faker/random/test.ex b/lib/faker/random/test.ex index 254faf212..2f07c1b91 100644 --- a/lib/faker/random/test.ex +++ b/lib/faker/random/test.ex @@ -1,6 +1,8 @@ defmodule Faker.Random.Test do @moduledoc false + use Faker.Random + def random_between(left, right) do set_seed(:ets.lookup(:seed_registry, self())) Enum.random(left..right) @@ -9,7 +11,7 @@ defmodule Faker.Random.Test do def random_bytes(total) do set_seed(:ets.lookup(:seed_registry, self())) - Stream.repeatedly(fn -> Enum.random(0..255) end) + Stream.repeatedly(fn -> random_between(0, 255) end) |> Enum.take(total) |> IO.iodata_to_binary() end @@ -19,6 +21,87 @@ defmodule Faker.Random.Test do :rand.uniform() end + @spec shuffle(Enum.t()) :: list + def shuffle(enumerable) do + randomized = + Enum.reduce(enumerable, [], fn x, acc -> + [{:rand.uniform(), x} | acc] + end) + + shuffle_unwrap(:lists.keysort(1, randomized)) + end + + defp shuffle_unwrap([{_, h} | rest]), do: [h | shuffle_unwrap(rest)] + defp shuffle_unwrap([]), do: [] + + @spec random(Enum.t()) :: Enum.element() + def random(enumerable) + + def random(enumerable) when is_list(enumerable) do + case length(enumerable) do + 0 -> raise Enum.EmptyError + length -> enumerable |> drop_list(random_count(length)) |> hd() + end + end + + def random(first.._//step = range) do + case Range.size(range) do + 0 -> raise Enum.EmptyError + size -> first + random_count(size) * step + end + end + + def random(enumerable) do + result = + case Enumerable.slice(enumerable) do + {:ok, 0, _} -> + [] + + {:ok, count, fun} when is_function(fun, 1) -> + slice_list(fun.(enumerable), random_count(count), 1, 1) + + # TODO: Deprecate me in Elixir v1.18. + {:ok, count, fun} when is_function(fun, 2) -> + fun.(random_count(count), 1) + + {:ok, count, fun} when is_function(fun, 3) -> + fun.(random_count(count), 1, 1) + + {:error, _} -> + Enum.take_random(enumerable, 1) + end + + case result do + [] -> raise Enum.EmptyError + [elem] -> elem + end + end + + defp random_count(count) do + :rand.uniform(count) - 1 + end + + defp drop_list(list, 0), do: list + defp drop_list([_ | tail], counter), do: drop_list(tail, counter - 1) + defp drop_list([], _), do: [] + + defp slice_list(list, start, amount, step) do + if step == 1 do + list |> drop_list(start) |> take_list(amount) + else + list |> drop_list(start) |> take_every_list(amount, step - 1) + end + end + + defp take_list(_list, 0), do: [] + defp take_list([head | tail], counter), do: [head | take_list(tail, counter - 1)] + defp take_list([], _counter), do: [] + + defp take_every_list([head | tail], counter, to_drop), + do: [head | tail |> drop_list(to_drop) |> take_every_list(counter - 1, to_drop)] + + defp take_every_list([], _counter, _to_drop), do: [] + defp set_seed([]) do :rand.seed(:exsplus, {1, 1, 1}) :ets.insert(:seed_registry, {self(), true}) diff --git a/lib/faker/util.ex b/lib/faker/util.ex index 34bae38d1..20b88d034 100644 --- a/lib/faker/util.ex +++ b/lib/faker/util.ex @@ -41,17 +41,25 @@ defmodule Faker.Util do iex> Faker.Util.sample_uniq(2, &Faker.Internet.email/0) ["conor2058@schiller.com", "elizabeth2056@rolfson.net"] - iex> Faker.Util.sample_uniq(10, fn -> Faker.String.base64(4) end) - ["1tmL", "29Te", "Byiy", "Kfp7", "Z7xb", "lk8z", "pI0P", "yGb0", "ye3Q", "yfOB"] - + [ + "0CzJ", + "3nuk", + "D1Ip", + "IqFG", + "My3J", + "W3yW", + "e/kH", + "gd75", + "hVCK", + "snJn" + ] iex> Faker.Util.sample_uniq(1, &Faker.Phone.EnUs.area_code/0) - ["825"] - + ["508"] iex> Faker.Util.sample_uniq(0, &Faker.Internet.email/0) ** (FunctionClauseError) no function clause matching in Faker.Util.sample_uniq/3 """ - @spec sample_uniq(pos_integer, (() -> any), MapSet.t()) :: [any] + @spec sample_uniq(pos_integer, (-> any), MapSet.t()) :: [any] def sample_uniq(count, sampler, acc \\ MapSet.new()) when is_integer(count) and count > 0 and is_function(sampler, 0) do case MapSet.size(acc) do @@ -84,7 +92,7 @@ defmodule Faker.Util do Enum.map(0..(n - 1), &fun.(&1)) end - @spec list(integer, (() -> any)) :: [any] + @spec list(integer, (-> any)) :: [any] def list(n, fun) when is_function(fun, 0) do Enum.map(0..(n - 1), fn _ -> fun.() end) end @@ -103,7 +111,7 @@ defmodule Faker.Util do iex> Faker.Util.join(2, " or ", &Faker.Color.name/0) "Purple or White" """ - @spec join(integer, binary, (() -> binary)) :: binary + @spec join(integer, binary, (-> binary)) :: binary def join(n, joiner \\ "", fun) do Enum.join(list(n, fun), joiner) end @@ -115,12 +123,6 @@ defmodule Faker.Util do iex> Faker.Util.digit() "0" - iex> Faker.Util.digit() - "1" - iex> Faker.Util.digit() - "5" - iex> Faker.Util.digit() - "4" """ @spec digit() :: binary localize(:digit) @@ -151,14 +153,6 @@ defmodule Faker.Util do iex> Faker.Util.letter() "E" - iex> Faker.Util.letter() - "L" - iex> Faker.Util.letter() - "R" - iex> Faker.Util.letter() - "C" - iex> Faker.Util.letter() - "e" """ @spec letter() :: binary localize(:letter) @@ -170,12 +164,6 @@ defmodule Faker.Util do iex> Faker.Util.lower_letter() "e" - iex> Faker.Util.lower_letter() - "l" - iex> Faker.Util.lower_letter() - "r" - iex> Faker.Util.lower_letter() - "c" """ @spec lower_letter() :: binary localize(:lower_letter) @@ -187,12 +175,6 @@ defmodule Faker.Util do iex> Faker.Util.upper_letter() "E" - iex> Faker.Util.upper_letter() - "L" - iex> Faker.Util.upper_letter() - "R" - iex> Faker.Util.upper_letter() - "C" """ @spec upper_letter() :: binary localize(:upper_letter) @@ -216,7 +198,7 @@ defmodule Faker.Util do def cycle(cycle_pid) do Agent.get_and_update(cycle_pid, fn {[], items} -> - [h | t] = Enum.shuffle(items) + [h | t] = Faker.shuffle(items) {h, {t, items}} {[h | t], items} -> diff --git a/lib/faker/vehicle.ex b/lib/faker/vehicle.ex index 5a20a9d66..9c0b00d6d 100644 --- a/lib/faker/vehicle.ex +++ b/lib/faker/vehicle.ex @@ -11,6 +11,7 @@ defmodule Faker.Vehicle do Returns a vehicle body style string ## Examples + iex> Faker.Vehicle.body_style() "Minivan" iex> Faker.Vehicle.body_style() @@ -27,6 +28,7 @@ defmodule Faker.Vehicle do Returns a vehicle drivetrain string ## Examples + iex> Faker.Vehicle.drivetrain() "4x2/2-wheel drive" iex> Faker.Vehicle.drivetrain() @@ -43,6 +45,7 @@ defmodule Faker.Vehicle do Returns a vehicle fuel type string ## Examples + iex> Faker.Vehicle.fuel_type() "Ethanol" iex> Faker.Vehicle.fuel_type() @@ -128,6 +131,7 @@ defmodule Faker.Vehicle do Returns a vehicle option string ## Examples + iex> Faker.Vehicle.option() "Premium Sound" iex> Faker.Vehicle.option() @@ -161,13 +165,14 @@ defmodule Faker.Vehicle do Returns a list of vehicle options() ## Examples - iex> Faker.Vehicle.options + + iex> Faker.Vehicle.options() ["Power Steering", "A/C: Front", "Keyless Entry", "AM/FM Stereo", "Power Steering", "Antilock Brakes", "8-Track Player", "Leather Interior"] - iex> Faker.Vehicle.options + iex> Faker.Vehicle.options() ["MP3 (Multi Disc)", "A/C: Rear", "Fog Lights", "Power Windows", "Cruise Control", "Premium Sound", "A/C: Front"] - iex> Faker.Vehicle.options + iex> Faker.Vehicle.options() ["Tinted Glass", "MP3 (Single Disc)", "CD (Multi Disc)"] - iex> Faker.Vehicle.options + iex> Faker.Vehicle.options() ["Fog Lights", "Rear Window Wiper", "MP3 (Multi Disc)", "Navigation", "Airbag: Side", "Rear Window Defroster", "Premium Sound"] """ @spec options(non_neg_integer()) :: list(String.t()) @@ -179,6 +184,7 @@ defmodule Faker.Vehicle do Returns a vehicle standard option string ## Examples + iex> Faker.Vehicle.standard_spec() "Tire pressure monitoring system (TPMS)" iex> Faker.Vehicle.standard_spec() @@ -195,6 +201,7 @@ defmodule Faker.Vehicle do Returns a list of vehicle standard specs ## Examples + iex> Faker.Vehicle.standard_specs() ["20\\" x 9.0\\" front & 20\\" x 10.0\\" rear aluminum wheels", "Deluxe insulation group", "Torsion beam rear suspension w/stabilizer bar", "High performance suspension", "200mm front axle", "Traveler/mini trip computer", "P235/50R18 all-season tires", "Front door tinted glass"] iex> Faker.Vehicle.standard_specs() @@ -213,6 +220,7 @@ defmodule Faker.Vehicle do Returns a list of vehicle standard specs of the given length ## Examples + iex> Faker.Vehicle.En.standard_specs(3) ["Tire pressure monitoring system (TPMS)", "20\\" x 9.0\\" front & 20\\" x 10.0\\" rear aluminum wheels", "Deluxe insulation group"] iex> Faker.Vehicle.En.standard_specs(3) @@ -231,14 +239,9 @@ defmodule Faker.Vehicle do Returns a vehicle transmission string ## Examples + iex> Faker.Vehicle.transmission() "CVT" - iex> Faker.Vehicle.transmission() - "Automatic" - iex> Faker.Vehicle.transmission() - "Manual" - iex> Faker.Vehicle.transmission() - "Automanual" """ @spec transmission() :: String.t() localize(:transmission) @@ -247,14 +250,15 @@ defmodule Faker.Vehicle do Returns a vehicle identification number string ## Examples + iex> Faker.Vehicle.vin() - "1C68203VCV0360337" + "1C689K5Y000T03374" iex> Faker.Vehicle.vin() - "5190V7FL8YX113016" + "D0B19RGCD90H16449" iex> Faker.Vehicle.vin() - "4RSE9035H9JA97940" + "RSE90354760B00530" iex> Faker.Vehicle.vin() - "59E4A13G890C97377" + "L9Z63TST830A76983" """ def vin do Util.format("%10x%y%x%5d", diff --git a/lib/faker/vehicle/en.ex b/lib/faker/vehicle/en.ex index b57fd7a31..acad561a2 100644 --- a/lib/faker/vehicle/en.ex +++ b/lib/faker/vehicle/en.ex @@ -277,6 +277,7 @@ defmodule Faker.Vehicle.En do Returns a vehicle body style string ## Examples + iex> Faker.Vehicle.En.body_style() "Minivan" iex> Faker.Vehicle.En.body_style() @@ -306,6 +307,7 @@ defmodule Faker.Vehicle.En do Returns a vehicle drivetrain string ## Examples + iex> Faker.Vehicle.En.drivetrain() "4x2/2-wheel drive" iex> Faker.Vehicle.En.drivetrain() @@ -322,6 +324,7 @@ defmodule Faker.Vehicle.En do Returns a vehicle fuel type string ## Examples + iex> Faker.Vehicle.En.fuel_type() "Ethanol" iex> Faker.Vehicle.En.fuel_type() @@ -424,6 +427,7 @@ defmodule Faker.Vehicle.En do Returns a vehicle option string ## Examples + iex> Faker.Vehicle.En.option() "Premium Sound" iex> Faker.Vehicle.En.option() @@ -442,13 +446,14 @@ defmodule Faker.Vehicle.En do Returns a list of vehicle options() ## Examples - iex> Faker.Vehicle.En.options + + iex> Faker.Vehicle.En.options() ["Power Steering", "A/C: Front", "Keyless Entry", "AM/FM Stereo", "Power Steering", "Antilock Brakes", "8-Track Player", "Leather Interior"] - iex> Faker.Vehicle.En.options + iex> Faker.Vehicle.En.options() ["MP3 (Multi Disc)", "A/C: Rear", "Fog Lights", "Power Windows", "Cruise Control", "Premium Sound", "A/C: Front"] - iex> Faker.Vehicle.En.options + iex> Faker.Vehicle.En.options() ["Tinted Glass", "MP3 (Single Disc)", "CD (Multi Disc)"] - iex> Faker.Vehicle.En.options + iex> Faker.Vehicle.En.options() ["Fog Lights", "Rear Window Wiper", "MP3 (Multi Disc)", "Navigation", "Airbag: Side", "Rear Window Defroster", "Premium Sound"] """ @spec options() :: list(String.t()) @@ -460,6 +465,7 @@ defmodule Faker.Vehicle.En do Returns a list of vehicle options of the given length ## Examples + iex> Faker.Vehicle.En.options(3) ["Premium Sound", "Power Steering", "A/C: Front"] iex> Faker.Vehicle.En.options(3) @@ -478,6 +484,7 @@ defmodule Faker.Vehicle.En do Reterns a vehicle standard option string ## Examples + iex> Faker.Vehicle.En.standard_spec() "Tire pressure monitoring system (TPMS)" iex> Faker.Vehicle.En.standard_spec() @@ -496,6 +503,7 @@ defmodule Faker.Vehicle.En do Returns a list of vehicle standard specs ## Examples + iex> Faker.Vehicle.En.standard_specs() ["20\\" x 9.0\\" front & 20\\" x 10.0\\" rear aluminum wheels", "Deluxe insulation group", "Torsion beam rear suspension w/stabilizer bar", "High performance suspension", "200mm front axle", "Traveler/mini trip computer", "P235/50R18 all-season tires", "Front door tinted glass"] iex> Faker.Vehicle.En.standard_specs() @@ -514,6 +522,7 @@ defmodule Faker.Vehicle.En do Returns a list of vehicle standard specs of the given length ## Examples + iex> Faker.Vehicle.En.standard_specs(3) ["Tire pressure monitoring system (TPMS)", "20\\" x 9.0\\" front & 20\\" x 10.0\\" rear aluminum wheels", "Deluxe insulation group"] iex> Faker.Vehicle.En.standard_specs(3) @@ -532,6 +541,7 @@ defmodule Faker.Vehicle.En do Returns a vehicle transmission string ## Examples + iex> Faker.Vehicle.En.transmission() "CVT" iex> Faker.Vehicle.En.transmission() diff --git a/mix.exs b/mix.exs index 223b29003..4d9053e67 100644 --- a/mix.exs +++ b/mix.exs @@ -14,6 +14,9 @@ defmodule Faker.Mixfile do name: "Faker", deps: deps(), docs: docs(), + preferred_cli_env: [ + "test.watch": :test + ], dialyzer: [ flags: [ :error_handling, @@ -44,7 +47,8 @@ defmodule Faker.Mixfile do {:ex_doc, "== 0.33.0", only: :dev, runtime: false}, {:earmark, "1.4.46", only: :dev, runtime: false}, {:credo, "== 1.7.5", only: [:dev, :test], runtime: false}, - {:dialyxir, "== 1.4.3", only: [:dev], runtime: false} + {:dialyxir, "== 1.4.3", only: [:dev], runtime: false}, + {:mix_test_watch, "~> 1.0", only: [:dev, :test], runtime: false} ] end diff --git a/mix.lock b/mix.lock index c5568ba9b..0d63c84ed 100644 --- a/mix.lock +++ b/mix.lock @@ -11,6 +11,7 @@ "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, + "mix_test_watch": {:hex, :mix_test_watch, "1.2.0", "1f9acd9e1104f62f280e30fc2243ae5e6d8ddc2f7f4dc9bceb454b9a41c82b42", [:mix], [{:file_system, "~> 0.2 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "278dc955c20b3fb9a3168b5c2493c2e5cffad133548d307e0a50c7f2cfbf34f6"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, }