N0REP0
### ###################
### :I: opam setup
### ###################
### :I:1: opam root
### test -d OPAM
### ls OPAM
config
config.lock
lock
opam-init
repo
### opam var root
${BASEDIR}/OPAM
### :I:1: repo
### find REPO | sort
REPO
REPO/packages
REPO/repo
### cat REPO/repo
opam-version: "2.0"
### ###################
### :II: File creation
### ###################
### :II:1: simple file
### <a-file>
and some content
### cat a-file
and some content
### <some/directory/file>
and still some content
### :II:2: package file in repo, and repository update
### opam switch create reftests --empty
### opam list --all
# Packages matching: any
# No matches found
### <pkg:foo.1>
opam-version: "2.0"
### cat REPO/packages/foo/foo.1/opam
opam-version: "2.0"
### opam list --all
# Packages matching: any
# Name # Installed # Synopsis
foo    --
### :II:3: extrafile file in repo
### <pkg:foo.1:xfile>
i'm with package foo
### cat REPO/packages/foo/foo.1/files/xfile
i'm with package foo
### :II:4: opam file for pin
### <pin:pkg.opam>
opam-version: "2.0"
### cat pkg.opam
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "MIT"
dev-repo: "hg+https://pkg@op.am"
bug-reports: "https://nobug"
### <pin:pkg/pkg.opam>
opam-version: "2.0"
### cat pkg/pkg.opam
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "MIT"
dev-repo: "hg+https://pkg@op.am"
bug-reports: "https://nobug"
### :II:5: opam file for pin with content
### <pin:pkg.opam>
opam-version: "2.0"
synopsis: "something"
build: ["false"]
### cat pkg.opam
opam-version: "2.0"
synopsis: "something"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "MIT"
dev-repo: "hg+https://pkg@op.am"
bug-reports: "https://nobug"
build: ["false"]
### :II:6: extra-files management
### :II:6:a: opamfile then extrafile
### <pkg:bar.1>
opam-version: "2.0"
### cat REPO/packages/bar/bar.1/opam
opam-version: "2.0"
### <pkg:bar.1:xf-bar>
I'm an extra file
### cat REPO/packages/bar/bar.1/opam
opam-version: "2.0"
extra-files: ["xf-bar" "md5=dbaf1ea561686374373dc7d154f3a0ff"]
### :II:6:b: extrafile then opamfile
### <pkg:baz.1:xf-baz>
I'm an another extra file
### test -f REPO/packages/baz/baz.1/opam
# Return code 1 #
### <pkg:baz.1>
opam-version: "2.0"
### cat REPO/packages/baz/baz.1/opam
opam-version: "2.0"
extra-files: ["xf-baz" "md5=9ac116bceba2bdf45065df19d26a6b64"]
### :II:6:c: redefinie opamfile
### <pkg:qux.1>
opam-version: "2.0"
### cat REPO/packages/qux/qux.1/opam
opam-version: "2.0"
### <pkg:qux.1:xf-qux>
I'm yet another extra file
### cat REPO/packages/qux/qux.1/opam
opam-version: "2.0"
extra-files: ["xf-qux" "md5=ccacf3e9d1e3f473e093042aa309e9da"]
### <pkg:qux.1>
opam-version: "2.0"
### cat REPO/packages/qux/qux.1/opam
opam-version: "2.0"
extra-files: ["xf-qux" "md5=ccacf3e9d1e3f473e093042aa309e9da"]
### :II:6:d: redefinie extrafile
### <pkg:corge.1:xf-corge>
I'm an yet another another extra file
### <pkg:corge.1>
opam-version: "2.0"
### cat REPO/packages/corge/corge.1/opam
opam-version: "2.0"
extra-files: ["xf-corge" "md5=d419630b165e4f2a1ad55d26c9b19e40"]
### <pkg:corge.1:xf-corge>
I'm the final one
### cat REPO/packages/corge/corge.1/opam
opam-version: "2.0"
extra-files: ["xf-corge" "md5=71e14bfb95ec10cb60f3b6cafd908a08"]
### :II:6:e: opamfile contains already extrafile defined
### <pkg:grault.1>
opam-version: "2.0"
extra-files: [ "file" "md5=00000000000000000000000000000000" ]
### cat REPO/packages/grault/grault.1/opam
opam-version: "2.0"
extra-files: [ "file" "md5=00000000000000000000000000000000" ]
### <pkg:grault.1:xf-grault>
It was not the final in the end
### cat REPO/packages/grault/grault.1/opam
opam-version: "2.0"
extra-files: [
  ["file" "md5=00000000000000000000000000000000"]
  ["xf-grault" "md5=9fd8d4d58e5fd899478b03ab24a11d00"]
]
### <pkg:grault.1:xf-grault2>
I'm the real final!
### cat REPO/packages/grault/grault.1/opam
opam-version: "2.0"
extra-files: [
  ["file" "md5=00000000000000000000000000000000"]
  ["xf-grault" "md5=9fd8d4d58e5fd899478b03ab24a11d00"]
  ["xf-grault2" "md5=5c1ff559ac6490338d362978c058f44a"]
]
### ###################
### :III: Environment variables
### ###################
### :III:1: definition
### FOO=foo
### echo $FOO
foo
### BAR=bar echo $BAR
bar
### :III:2: set
### echo baz >$ BAZ
### echo $BAZ
baz
### :III:3: spaces in variable expansion
### echo "tree   spaces should appear as 3 spaces" >$ SPACES
### echo $SPACES
tree   spaces should appear as 3 spaces
### ###################
### :IV: rewrites
### ###################
### <rewrites>
lorem ipsum dolor sit amet
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
dignissim sit amet
### :IV:1: grep
### cat rewrites | grep amet
lorem ipsum dolor sit amet
dignissim sit amet
### :IV:2: grep -v
### cat rewrites | grep -v amet
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
### cat rewrites | "amet" -> '\c'
lorem ipsum dolor sit \c
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
dignissim sit \c
### :IV:3: regexp
### cat rewrites | "amet" -> "XXX"
lorem ipsum dolor sit XXX
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
dignissim sit XXX
### cat rewrites | "Lorem.*" -> "XXX"
lorem ipsum dolor sit amet
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
dignissim sit amet
### IPSUM=ipsum
### cat rewrites | "${IPSUM}" -> "XXX"
lorem XXX dolor sit amet
consectetur adipiscing elit
sed non risus
suspendisse lectus tortor
dignissim sit amet
### :IV:4: unordered
### <random.ml>
Random.self_init ();
let fst () = print_endline "first" in
let snd () = print_endline "second" in
let rand = Random.int 100 in
if rand mod 2 = 0 then
  (fst (); snd ())
else
  (snd (); fst ())
### ocaml random.ml | unordered
first
second
### :IV:5: sort
### cat rewrites | sort
consectetur adipiscing elit
dignissim sit amet
lorem ipsum dolor sit amet
sed non risus
suspendisse lectus tortor
### :IV:6: sed-cmd
### <commands>
/usr/bin/echo piou
"/usr/bin/echo" "piou"
C:\Windows\system32\echo.exe piou
C:\Windows\system32\echo piou
C:\Windows\system 32\echo.exe piou
C:\Windows\system 32\echo piou
/tmp/build_592d92_dune/opam-reftest-2b89f9/OPAM/opam-init/hooks/sandbox.sh "build" "echo" piou
/tmp/build_592d92_dune/opam-reftest-2b89f9/OPAM/opam-init/hooks/sandbox.sh "install" "echo" piou
/tmp/build_592d92_dune/opam-reftest-2b89f9/OPAM/opam-init/hooks/sandbox.sh "remove" "echo" piou
${BASEDIR}/opam-init/hooks/sandbox.sh "build" "echo" piou
${BASEDIR}/opam-init/hooks/sandbox.sh "install" "echo" piou
${BASEDIR}/opam-init/hooks/sandbox.sh "remove" "echo" piou
/usr/bin/echo
### : cmd need to be followed with at least one space
### cat commands | sed-cmd echo
echo piou
echo "piou"
echo piou
echo piou
echo piou
echo piou
echo piou
echo piou
echo piou
echo piou
echo piou
echo piou
/usr/bin/echo
### ###################
### :V: Additional commands
### ###################
### :V:1: opam-cat
### <pkg.opam>
opam-version: "2.0"
build:
  [ "false" ]
install:
  [
    [ "true" ]
  ]
### opam-cat pkg.opam
build: ["false"]
install: [["true"]]
opam-version: "2.0"
### :V:2: json-cat
### opam switch create empty --empty --json=opam.json
### json-cat opam.json
{
  "opam-version": "currentv",
  "command-line": [
    "${OPAM}",
    "switch",
    "create",
    "empty",
    "--empty",
    "--json=opam.json"
  ]
}
### opam install foo --json=opam.json
The following actions will be performed:
=== install 1 package
  - install foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed foo.1
Done.
### json-cat opam.json
{
  "opam-version": "currentv",
  "command-line": [
    "${OPAM}",
    "install",
    "foo",
    "--json=opam.json"
  ],
  "switch": "empty",
  "request": {
    "action": "install",
    "install": [
      "foo"
    ],
    "remove": [],
    "upgrade": [],
    "all": [
      "foo"
    ],
    "criteria": "-removed,-count[avoid-version,changed],-count[version-lag,request],-count[version-lag,changed],-count[missing-depexts,changed],-changed"
  },
  "solution": [
    {
      "install": {
        "name": "foo",
        "version": "1"
      }
    }
  ],
  "results": [
    {
      "action": {
        "build": {
          "name": "foo",
          "version": "1"
        }
      },
      "result": "OK",
      "duration": 6.2831853071
    },
    {
      "action": {
        "install": {
          "name": "foo",
          "version": "1"
        }
      },
      "result": "OK",
      "duration": 6.2831853071
    }
  ]
}
### :V:3: Cache cat
### <OPER/repo>
opam-version: "2.0"
### <OPER/packages/foo/foo.2/opam>
opam-version: "2.0"
### <OPER/packages/un/un.2/opam>
opam-version: "2.0"
### <OPER/packages/deux/deux.2/opam>
opam-version: "2.0"
### opam switch create cache --empty
### opam repository add oper ./OPER
[oper] Initialised
[NOTE] Repository oper has been added to the selections of switch cache only.
       Run `opam repository add oper --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively.

### opam install bar baz foo un deux
The following actions will be performed:
=== install 5 packages
  - install bar  1
  - install baz  1
  - install deux 2
  - install foo  2
  - install un   2

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
-> installed bar.1
-> installed baz.1
-> installed deux.2
-> installed foo.2
-> installed un.2
Done.
### :V:3: installed packages cache
### opam-cache installed cache
=> un.2 <=
opam-version: "2.0"
name: "un"
version: "2"
=> foo.2 <=
opam-version: "2.0"
name: "foo"
version: "2"
=> deux.2 <=
opam-version: "2.0"
name: "deux"
version: "2"
=> baz.1 <=
opam-version: "2.0"
name: "baz"
version: "1"
extra-files: ["xf-baz" "md5=9ac116bceba2bdf45065df19d26a6b64"]
=> bar.1 <=
opam-version: "2.0"
name: "bar"
version: "1"
extra-files: ["xf-bar" "md5=dbaf1ea561686374373dc7d154f3a0ff"]
### opam-cache installed cache foo
=> foo.2 <=
opam-version: "2.0"
name: "foo"
version: "2"
### opam-cache installed cache foo un
=> un.2 <=
opam-version: "2.0"
name: "un"
version: "2"
=> foo.2 <=
opam-version: "2.0"
name: "foo"
version: "2"
### opam-cache installed cache inexistent
### opam switch create cache2 --empty
### opam-cache installed cache2
Empty cache
### opam-cache installed cache2 foo
Empty cache
### opam-cache installed cache3
No cache
### :V:3:b: repo cache
### opam-cache repo
=> oper:un.2 <=
opam-version: "2.0"
name: "un"
version: "2"
=> oper:foo.2 <=
opam-version: "2.0"
name: "foo"
version: "2"
=> oper:deux.2 <=
opam-version: "2.0"
name: "deux"
version: "2"
=> default:qux.1 <=
opam-version: "2.0"
name: "qux"
version: "1"
extra-files: ["xf-qux" "md5=ccacf3e9d1e3f473e093042aa309e9da"]
=> default:grault.1 <=
opam-version: "2.0"
name: "grault"
version: "1"
extra-files: [
  ["file" "md5=00000000000000000000000000000000"]
  ["xf-grault" "md5=9fd8d4d58e5fd899478b03ab24a11d00"]
  ["xf-grault2" "md5=5c1ff559ac6490338d362978c058f44a"]
]
=> default:foo.1 <=
opam-version: "2.0"
name: "foo"
version: "1"
extra-files: ["xfile" "md5=f343d90d29f2632b7e5fcf8ee249d1b5"]
=> default:corge.1 <=
opam-version: "2.0"
name: "corge"
version: "1"
extra-files: ["xf-corge" "md5=71e14bfb95ec10cb60f3b6cafd908a08"]
=> default:baz.1 <=
opam-version: "2.0"
name: "baz"
version: "1"
extra-files: ["xf-baz" "md5=9ac116bceba2bdf45065df19d26a6b64"]
=> default:bar.1 <=
opam-version: "2.0"
name: "bar"
version: "1"
extra-files: ["xf-bar" "md5=dbaf1ea561686374373dc7d154f3a0ff"]
### opam-cache repo foo
=> oper:foo.2 <=
opam-version: "2.0"
name: "foo"
version: "2"
=> default:foo.1 <=
opam-version: "2.0"
name: "foo"
version: "1"
extra-files: ["xfile" "md5=f343d90d29f2632b7e5fcf8ee249d1b5"]
### opam-cache repo un baz
=> oper:un.2 <=
opam-version: "2.0"
name: "un"
version: "2"
=> default:baz.1 <=
opam-version: "2.0"
name: "baz"
version: "1"
extra-files: ["xf-baz" "md5=9ac116bceba2bdf45065df19d26a6b64"]
### opam-cache repo inexistent
