Docspec



examples/docspec/shard.yml
name: Anagram
version: 0.0.1

authors:
   - Gabor Szabo <gabor@szabgab.com>

development_dependencies:
  docspec:
    github: skippi/docspec

license: MIT

examples/docspec/spec/anagram_spec.cr
require "spec"
require "../src/app"
describe "Try" do
  it "anagram" do
    anagram?("abc", "cba").should be_true
    anagram?("abc", "abd").should be_false
  end
end

examples/docspec/spec/doctes_spec.cr
require "docspec"

Docspec.doctest("../src/app.cr")

examples/docspec/src/app.cr
# ```
# >> anagram?("abc", "bca") # => true
# >> anagram?("abc", "abd") # => false
# ```
def anagram?(x, y)
  return x.split("").sort == y.split("").sort
end