From e429d432d56b6b0815be7ce83df0d025a74a0294 Mon Sep 17 00:00:00 2001 From: Nicolai Bach Woller Date: Mon, 14 Oct 2024 13:44:29 +0200 Subject: [PATCH 1/4] Add Danish license plate. --- lib/locales/da-DK.yml | 2 ++ test/test_da_dk_locale.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/lib/locales/da-DK.yml b/lib/locales/da-DK.yml index e5889f452d..8223d7c9c6 100644 --- a/lib/locales/da-DK.yml +++ b/lib/locales/da-DK.yml @@ -565,3 +565,5 @@ da-DK: - Bænk - Ur - Pung + vehicle: + license_plate: '[A-Z]{2}\d{5}' diff --git a/test/test_da_dk_locale.rb b/test/test_da_dk_locale.rb index 71639116e2..ae52bc580d 100644 --- a/test/test_da_dk_locale.rb +++ b/test/test_da_dk_locale.rb @@ -60,4 +60,8 @@ def test_da_dk_counrty_code assert_match(/(\+45)[\s](\d\d[\s-]?){4}$/, Faker::PhoneNumber.phone_number_with_country_code) assert_match(/(\+45)[\s](\d\d[\s-]?){4}$/, Faker::PhoneNumber.cell_phone_with_country_code) end + + def test_da_dk_license_plate + assert_match(/^[A-Z]{2}\d{5}$/, Faker::Vehicle.license_plate) + end end From 94584a13435c8e04fa6ff3b582b13279addd6973 Mon Sep 17 00:00:00 2001 From: Nicolai Bach Woller Date: Mon, 14 Oct 2024 13:58:42 +0200 Subject: [PATCH 2/4] Fix. Ensure license plate validity. --- lib/locales/da-DK.yml | 2 +- test/test_da_dk_locale.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/locales/da-DK.yml b/lib/locales/da-DK.yml index 8223d7c9c6..e983afd407 100644 --- a/lib/locales/da-DK.yml +++ b/lib/locales/da-DK.yml @@ -566,4 +566,4 @@ da-DK: - Ur - Pung vehicle: - license_plate: '[A-Z]{2}\d{5}' + license_plate: '[A-F]{2}\d{5}' diff --git a/test/test_da_dk_locale.rb b/test/test_da_dk_locale.rb index ae52bc580d..fe97ff4a6b 100644 --- a/test/test_da_dk_locale.rb +++ b/test/test_da_dk_locale.rb @@ -62,6 +62,6 @@ def test_da_dk_counrty_code end def test_da_dk_license_plate - assert_match(/^[A-Z]{2}\d{5}$/, Faker::Vehicle.license_plate) + assert_match(/^(O[A-HJ-NPR-Z](?![BHBUCCCDDKDUEUKZMUYPSSUDUNVC])|[A-HJ-NPR-Z]{2})(\d{2,5})$/, Faker::Vehicle.license_plate) end end From 66d0f11d0828cf91c4a56114c0058b7fa813a167 Mon Sep 17 00:00:00 2001 From: Nicolai Bach Woller Date: Fri, 18 Oct 2024 07:12:46 +0200 Subject: [PATCH 3/4] Update lib/locales/da-DK.yml Co-authored-by: Stefanni Brasil --- lib/locales/da-DK.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/locales/da-DK.yml b/lib/locales/da-DK.yml index e983afd407..a9c14a30f7 100644 --- a/lib/locales/da-DK.yml +++ b/lib/locales/da-DK.yml @@ -566,4 +566,4 @@ da-DK: - Ur - Pung vehicle: - license_plate: '[A-F]{2}\d{5}' + license_plate: '[A-Z]{2}[0-9]{5}' From c499b8dbda705436c161d5d879a53274e1a9fa6a Mon Sep 17 00:00:00 2001 From: Nicolai Bach Woller Date: Mon, 21 Oct 2024 07:31:02 +0200 Subject: [PATCH 4/4] Simplify regex. --- test/test_da_dk_locale.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_da_dk_locale.rb b/test/test_da_dk_locale.rb index fe97ff4a6b..6bf5e2b6a2 100644 --- a/test/test_da_dk_locale.rb +++ b/test/test_da_dk_locale.rb @@ -62,6 +62,6 @@ def test_da_dk_counrty_code end def test_da_dk_license_plate - assert_match(/^(O[A-HJ-NPR-Z](?![BHBUCCCDDKDUEUKZMUYPSSUDUNVC])|[A-HJ-NPR-Z]{2})(\d{2,5})$/, Faker::Vehicle.license_plate) + assert_match(/[A-Z]{2}[0-9]{5}/, Faker::Vehicle.license_plate) end end