Test cases to check Coq's flag setting is correct:

  $ cat > dune-project <<EOF
  > (lang dune 3.21)
  > (using rocq 0.11)
  > EOF

  $ cat > foo.v <<EOF
  > Definition t := 3.
  > EOF

  $ runFlags() {
  > dune clean
  > dune build foo.vo
  > dune trace cat | jq -c 'include "dune"; rocqFlags'
  > }

Test case: default flags

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: :standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo)
  >  (flags :standard))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: override :standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo)
  >  (flags ))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: add to :standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo)
  >  (flags :standard -type-in-type))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: extend in workspace + override standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo)
  >  (flags :standard))
  > EOF

  $ cat > dune-workspace <<EOF
  > (lang dune 3.21)
  > (env (dev (rocq (flags -type-in-type))))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: extend in workspace + override standard

  $ cat > dune-workspace <<EOF
  > (lang dune 3.21)
  > (env (dev (rocq (flags :standard -type-in-type))))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: extend in dune (env) + override standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo))
  > (env (dev (rocq (flags -type-in-type))))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: extend in dune (env) + standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo))
  > (env (dev (rocq (flags :standard -type-in-type))))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-type-in-type","-type-in-type","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}

TC: extend in dune (env) + workspace + standard

  $ cat > dune <<EOF
  > (rocq.theory
  >  (name foo))
  > (env (dev (rocq (flags :standard -bt))))
  > EOF

  $ cat > dune-workspace <<EOF
  > (lang dune 3.21)
  > (env (dev (rocq (flags :standard -type-in-type))))
  > EOF

  $ runFlags
  {"name":"rocq","args":["c","--config"]}
  {"name":"rocq","args":["dep","-boot","-R","coq/theories","Corelib","-R",".","foo","-dyndep","opt","-vos","foo.v"]}
  {"name":"rocq","args":["compile","-q","-type-in-type","-bt","-w","-deprecated-native-compiler-option","-native-output-dir",".","-native-compiler","on","-nI","rocq-runtime/kernel","-nI",".","-boot","-R","coq/theories","Corelib","-R",".","foo","foo.v"]}
