Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 13 additions & 0 deletions exercises/practice/pig-latin/.meta/template.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{ header }}

{{ exercise_name | remove_spaces }} = require './{{ exercise_slug }}'

describe {{ exercise_name | quote }}, ->
{% for group in groups %}
describe {{ group["description"] | quote }}, ->
{% for case in group["cases"] %}
{{ case["test_keyword"] }} {{ case["description"] | quote }}, ->
expect({{ exercise_name | remove_spaces }}.translate {{ case["input"]["phrase"] | quote }}).toEqual {{ case["expected"] | quote }}

{% endfor %}
{% endfor %}
10 changes: 10 additions & 0 deletions exercises/practice/pig-latin/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,13 @@ description = "position of y in a word determines if it is a consonant or a vowe

[44616581-5ce3-4a81-82d0-40c7ab13d2cf]
description = "phrases are translated -> a whole phrase"
include = false

[44616581-5ce3-4a81-82d0-40c7ab13d2d0]
description = "phrases are translated -> a whole phrase"
include = false
reimplements = "44616581-5ce3-4a81-82d0-40c7ab13d2cf"

[44616581-5ce3-4a81-82d0-40c7ab13d2d1]
description = "phrases are translated -> a whole phrase"
reimplements = "44616581-5ce3-4a81-82d0-40c7ab13d2d0"
200 changes: 79 additions & 121 deletions exercises/practice/pig-latin/pig-latin.spec.coffee
Original file line number Diff line number Diff line change
@@ -1,123 +1,81 @@
# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/blob/main/exercises/pig-latin/canonical-data.json
# File last updated on 2026-11-05T19:44:13+00:00

PigLatin = require './pig-latin'

describe 'Pig Latin', ->
describe 'ay is added to words that start with vowels', ->
it 'word beginning with a', ->
results = PigLatin.translate "apple"
expected = "appleay"
expect(results).toEqual expected

xit 'word beginning with e', ->
results = PigLatin.translate "ear"
expected = "earay"
expect(results).toEqual expected

xit 'word beginning with i', ->
results = PigLatin.translate "igloo"
expected = "iglooay"
expect(results).toEqual expected

xit 'word beginning with o', ->
results = PigLatin.translate "object"
expected = "objectay"
expect(results).toEqual expected

xit 'word beginning with u', ->
results = PigLatin.translate "under"
expected = "underay"
expect(results).toEqual expected

xit 'word beginning with a vowel and followed by a qu', ->
results = PigLatin.translate "equal"
expected = "equalay"
expect(results).toEqual expected

describe 'first letter and ay are moved to the end of words that start with consonants', ->
xit 'word beginning with p', ->
results = PigLatin.translate "pig"
expected = "igpay"
expect(results).toEqual expected

xit 'word beginning with k', ->
results = PigLatin.translate "koala"
expected = "oalakay"
expect(results).toEqual expected

xit 'word beginning with x', ->
results = PigLatin.translate "xenon"
expected = "enonxay"
expect(results).toEqual expected

xit 'word beginning with q without a following u', ->
results = PigLatin.translate "qat"
expected = "atqay"
expect(results).toEqual expected

xit 'word beginning with consonant and vowel containing qu', ->
results = PigLatin.translate "liquid"
expected = "iquidlay"
expect(results).toEqual expected

describe 'some letter clusters are treated as a single consonant', ->
xit 'word beginning with ch', ->
results = PigLatin.translate "chair"
expected = "airchay"
expect(results).toEqual expected

xit 'word beginning with qu', ->
results = PigLatin.translate "queen"
expected = "eenquay"
expect(results).toEqual expected

xit 'word beginning with qu and a preceding consonant', ->
results = PigLatin.translate "square"
expected = "aresquay"
expect(results).toEqual expected

xit 'word beginning with th', ->
results = PigLatin.translate "therapy"
expected = "erapythay"
expect(results).toEqual expected

xit 'word beginning with thr', ->
results = PigLatin.translate "thrush"
expected = "ushthray"
expect(results).toEqual expected

xit 'word beginning with sch', ->
results = PigLatin.translate "school"
expected = "oolschay"
expect(results).toEqual expected

describe 'some letter clusters are treated like a single vowel', ->
xit 'word beginning with yt', ->
results = PigLatin.translate "yttria"
expected = "yttriaay"
expect(results).toEqual expected

xit 'word beginning with xr', ->
results = PigLatin.translate "xray"
expected = "xrayay"
expect(results).toEqual expected

describe 'position of y in a word determines if xit is a consonant or a vowel', ->
xit 'y is treated like a consonant at the beginning of a word', ->
results = PigLatin.translate "yellow"
expected = "ellowyay"
expect(results).toEqual expected

xit 'y is treated like a vowel at the end of a consonant cluster', ->
results = PigLatin.translate "rhythm"
expected = "ythmrhay"
expect(results).toEqual expected

xit 'y as second letter in two letter word', ->
results = PigLatin.translate "my"
expected = "ymay"
expect(results).toEqual expected

describe 'phrases are translated', ->
xit 'a whole phrase', ->
results = PigLatin.translate "quick fast run"
expected = "ickquay astfay unray"
expect(results).toEqual expected
describe "Pig Latin", ->
describe "ay is added to words that start with vowels", ->
it "word beginning with a", ->
expect(PigLatin.translate "apple").toEqual "appleay"

xit "word beginning with e", ->
expect(PigLatin.translate "ear").toEqual "earay"

xit "word beginning with i", ->
expect(PigLatin.translate "igloo").toEqual "iglooay"

xit "word beginning with o", ->
expect(PigLatin.translate "object").toEqual "objectay"

xit "word beginning with u", ->
expect(PigLatin.translate "under").toEqual "underay"

xit "word beginning with a vowel and followed by a qu", ->
expect(PigLatin.translate "equal").toEqual "equalay"

describe "first letter and ay are moved to the end of words that start with consonants", ->
xit "word beginning with p", ->
expect(PigLatin.translate "pig").toEqual "igpay"

xit "word beginning with k", ->
expect(PigLatin.translate "koala").toEqual "oalakay"

xit "word beginning with x", ->
expect(PigLatin.translate "xenon").toEqual "enonxay"

xit "word beginning with q without a following u", ->
expect(PigLatin.translate "qat").toEqual "atqay"

xit "word beginning with consonant and vowel containing qu", ->
expect(PigLatin.translate "liquid").toEqual "iquidlay"

describe "some letter clusters are treated like a single consonant", ->
xit "word beginning with ch", ->
expect(PigLatin.translate "chair").toEqual "airchay"

xit "word beginning with qu", ->
expect(PigLatin.translate "queen").toEqual "eenquay"

xit "word beginning with qu and a preceding consonant", ->
expect(PigLatin.translate "square").toEqual "aresquay"

xit "word beginning with th", ->
expect(PigLatin.translate "therapy").toEqual "erapythay"

xit "word beginning with thr", ->
expect(PigLatin.translate "thrush").toEqual "ushthray"

xit "word beginning with sch", ->
expect(PigLatin.translate "school").toEqual "oolschay"

describe "some letter clusters are treated like a single vowel", ->
xit "word beginning with yt", ->
expect(PigLatin.translate "yttria").toEqual "yttriaay"

xit "word beginning with xr", ->
expect(PigLatin.translate "xray").toEqual "xrayay"

describe "position of y in a word determines if it is a consonant or a vowel", ->
xit "y is treated like a consonant at the beginning of a word", ->
expect(PigLatin.translate "yellow").toEqual "ellowyay"

xit "y is treated like a vowel at the end of a consonant cluster", ->
expect(PigLatin.translate "rhythm").toEqual "ythmrhay"

xit "y as second letter in two letter word", ->
expect(PigLatin.translate "my").toEqual "ymay"

describe "phrases are translated", ->
xit "a whole phrase", ->
expect(PigLatin.translate "why do squids enjoy xrays").toEqual "ywhay oday idssquay enjoyay xraysay"
Loading