{% set version = '2.0.1' %}

{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

package:
  name: r-testthat
  version: {{ version|replace("-", "_") }}

source:
  fn: testthat_{{ version }}.tar.gz
  url:
    - {{ cran_mirror }}/src/contrib/testthat_{{ version }}.tar.gz
    - {{ cran_mirror }}/src/contrib/Archive/testthat/testthat_{{ version }}.tar.gz
  sha256: fedf8748aa8abff1c905bae575f9efae1eaab4aca690423402d574a97bf14eb1

build:
  merge_build_host: True  # [win]
  number: 0

  rpaths:
    - lib/R/lib/
    - lib/

requirements:
  build:
    - {{ compiler('c') }}        # [not win]
    - {{ compiler('cxx') }}      # [not win]
    - {{native}}toolchain        # [win]
    - {{posix}}filesystem        # [win]
    - {{posix}}make
    - {{posix}}sed               # [win]
    - {{posix}}coreutils         # [win]
    - {{posix}}zip               # [win]

  host:
    - r-base
    - r-r6 >=2.2.0
    - r-cli
    - r-crayon
    - r-digest
    - r-magrittr
    - r-praise
    - r-rlang
    - r-withr >=2.0.0

  run:
    - r-base
    - {{native}}gcc-libs         # [win]
    - r-r6 >=2.2.0
    - r-cli
    - r-crayon
    - r-digest
    - r-magrittr
    - r-praise
    - r-rlang
    - r-withr >=2.0.0

test:
  commands:
    - $R -e "library('testthat')"           # [not win]
    - "\"%R%\" -e \"library('testthat')\""  # [win]

about:
  home: https://github.com/r-lib/testthat
  license: MIT
  summary: A unit testing system designed to be fun, flexible and easy to set up.
  license_family: MIT
  license_file: '{{ environ["PREFIX"] }}/lib/R/share/licenses/MIT'  # [unix]
  license_file: '{{ environ["PREFIX"] }}\R\share\licenses\MIT'  # [win]

extra:
  recipe-maintainers:
    - johanneskoester
    - bgruening
    - daler
    - jdblischak
    - cbrueffer
    - dbast
