diff --git a/exercises/practice/protein-translation/.docs/instructions.append.md b/exercises/practice/protein-translation/.docs/instructions.append.md new file mode 100644 index 00000000..61f37647 --- /dev/null +++ b/exercises/practice/protein-translation/.docs/instructions.append.md @@ -0,0 +1,13 @@ +# Instructions append + +This is a good exercise to experiment with non-standard string literals. + +A short introduction to non-standard string literals can be found in this [blog post](https://web.archive.org/web/20170625222109/https://iaindunning.com/blog/julia-unicode.html). + +You can extend your solution by adding the functionality described below. + +## Bonus +Implement a string literal that translates RNA strings as: +```julia +rna"AUGUGU" == ["Methionine", "Cysteine"] +``` diff --git a/exercises/practice/protein-translation/runtests.jl b/exercises/practice/protein-translation/runtests.jl index 75a8276a..3c538e46 100644 --- a/exercises/practice/protein-translation/runtests.jl +++ b/exercises/practice/protein-translation/runtests.jl @@ -77,4 +77,12 @@ include("protein-translation.jl") @testset "Incomplete RNA sequence can translate if given a stop codon" begin @test rna_to_amino_acids("UGGUGAUG") == ["Tryptophan"] end -end \ No newline at end of file + + # Bonus + if isdefined(@__MODULE__, Symbol("@rna_str")) + @eval @testset "Bonus: rna string macro" begin + @test rna"AUGUUUUUAUGGUACUAG" == ["Methionine", "Phenylalanine", "Leucine", "Tryptophan", "Tyrosine"] + end + end + +end