Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

da-DK license plates #3010

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/locales/da-DK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -565,3 +565,5 @@ da-DK:
- Bænk
- Ur
- Pung
vehicle:
license_plate: '[A-F]{2}\d{5}'
woller marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 4 additions & 0 deletions test/test_da_dk_locale.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(/^(O[A-HJ-NPR-Z](?![BHBUCCCDDKDUEUKZMUYPSSUDUNVC])|[A-HJ-NPR-Z]{2})(\d{2,5})$/, Faker::Vehicle.license_plate)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks too convoluted. What do you think of taking doing something like this:

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it is convoluted, but I think your suggestion got cut off - unless you want to really simplify it 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh, my bad! Changing computers mess up with my keyboard shortcuts 🙈

I meant something like:

assert_match(/^[A-Z]{2}-[0-9]{5}/, Faker::Vehicle.license_plate)

end
end