#!/usr/bin/env raku use Test; use JSON::Fast; use lib $?FILE.IO.dirname; use Acronym; plan 9; my @test-cases = from-json($=pod[*-1].contents).List; for @test-cases -> %case { is abbreviate(%case), |%case; } =head2 Test Cases =begin code [ { "description": "basic", "expected": "PNG", "input": { "phrase": "Portable Network Graphics" }, "property": "abbreviate" }, { "description": "lowercase words", "expected": "ROR", "input": { "phrase": "Ruby on Rails" }, "property": "abbreviate" }, { "description": "punctuation", "expected": "FIFO", "input": { "phrase": "First In, First Out" }, "property": "abbreviate" }, { "description": "all caps word", "expected": "GIMP", "input": { "phrase": "GNU Image Manipulation Program" }, "property": "abbreviate" }, { "description": "punctuation without whitespace", "expected": "CMOS", "input": { "phrase": "Complementary metal-oxide semiconductor" }, "property": "abbreviate" }, { "description": "very long abbreviation", "expected": "ROTFLSHTMDCOALM", "input": { "phrase": "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me" }, "property": "abbreviate" }, { "description": "consecutive delimiters", "expected": "SIMUFTA", "input": { "phrase": "Something - I made up from thin air" }, "property": "abbreviate" }, { "description": "apostrophes", "expected": "HC", "input": { "phrase": "Halley's Comet" }, "property": "abbreviate" }, { "description": "underscore emphasis", "expected": "TRNT", "input": { "phrase": "The Road _Not_ Taken" }, "property": "abbreviate" } ] =end code