This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,68 @@
|
|||
Test that we can write config parameters in both the configuration
|
||||
file and the workspace file.
|
||||
|
||||
$ echo '(lang dune 3.0)' > dune-project
|
||||
$ cat >dune<<EOF
|
||||
> (rule
|
||||
> (alias default)
|
||||
> (action (run echo "Hello, world!")))
|
||||
> EOF
|
||||
|
||||
Setting such options is not supported with older Dune:
|
||||
|
||||
$ cat >dune-workspace<<EOF
|
||||
> (lang dune 2.8)
|
||||
> (display short)
|
||||
> EOF
|
||||
$ dune build -f
|
||||
File "dune-workspace", line 2, characters 0-15:
|
||||
2 | (display short)
|
||||
^^^^^^^^^^^^^^^
|
||||
Error: 'display' is only available since version 3.0 of the dune language.
|
||||
Please update your dune config file to have (lang dune 3.0).
|
||||
[1]
|
||||
|
||||
But is supported with Dune >= 3.0.0:
|
||||
|
||||
$ cat >dune-workspace<<EOF
|
||||
> (lang dune 3.0)
|
||||
> (display short)
|
||||
> EOF
|
||||
$ dune build -f
|
||||
echo alias default
|
||||
Hello, world!
|
||||
|
||||
$ cat >dune-workspace<<EOF
|
||||
> (lang dune 3.0)
|
||||
> (display verbose)
|
||||
> EOF
|
||||
$ dune build -f 2>&1 | grep Hello | sed 's/&&.*echo/\&\& echo/'
|
||||
Running[1]: (cd _build/default && echo 'Hello, world!')
|
||||
Hello, world!
|
||||
|
||||
Make sure errors related to fields other than the ones allowed in the
|
||||
config field are not reported if we don't need to evaluate these
|
||||
fields:
|
||||
|
||||
$ mkdir errors
|
||||
$ cd errors
|
||||
|
||||
$ cat >dune-workspace<<EOF
|
||||
> (lang dune 3.0)
|
||||
> (context (blah))
|
||||
> EOF
|
||||
|
||||
$ dune init project foo
|
||||
Entering directory 'foo'
|
||||
Success: initialized project component named foo
|
||||
Leaving directory 'foo'
|
||||
|
||||
But if we do the build we do get an error:
|
||||
|
||||
$ dune build
|
||||
File "dune-workspace", line 2, characters 10-14:
|
||||
2 | (context (blah))
|
||||
^^^^
|
||||
Error: Unknown constructor blah
|
||||
[1]
|
||||
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
Tests verifying that the config file presents accurate error or warning
|
||||
messages when a stanza is used with a version of dune which does not support
|
||||
such a stanza.
|
||||
|
||||
Create a config file to use in the following tests. We will initialize the
|
||||
config with a version and a stanza incompatable with that version.
|
||||
|
||||
$ export DUNE_CACHE_ROOT=$PWD/dune-cache
|
||||
$ touch dune-config
|
||||
$ cat >dune-config <<EOF
|
||||
> (lang dune 1.0)
|
||||
> (cache enabled)
|
||||
> EOF
|
||||
|
||||
Attempt to initialize a new project while an invaild stanza due to versioning
|
||||
exists in the config.
|
||||
|
||||
$ dune init proj test --config-file=dune-config
|
||||
File "$TESTCASE_ROOT/dune-config", line 2, characters 0-15:
|
||||
2 | (cache enabled)
|
||||
^^^^^^^^^^^^^^^
|
||||
Error: 'cache' is only available since version 2.0 of the dune language.
|
||||
Please update your dune config file to have (lang dune 2.0).
|
||||
[1]
|
||||
|
||||
Update the dune configuration with a version that would support the
|
||||
'(cache enabled)' stanza and attempt a successful project initialization.
|
||||
|
||||
$ cat >dune-config <<EOF
|
||||
> (lang dune 2.0)
|
||||
> (cache enabled)
|
||||
> EOF
|
||||
|
||||
$ dune init proj test_vaild --config-file=dune-config
|
||||
Entering directory 'test_vaild'
|
||||
Success: initialized project component named test_vaild
|
||||
Leaving directory 'test_vaild'
|
||||
|
||||
Append an invaild stanza to the config file and attempt project initialzation.
|
||||
|
||||
$ echo "(cache-check-probability 0.5)" >> dune-config
|
||||
$ dune init proj test --config-file=dune-config
|
||||
File "$TESTCASE_ROOT/dune-config", line 3, characters 0-29:
|
||||
3 | (cache-check-probability 0.5)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Error: 'cache-check-probability' is only available since version 2.7 of the
|
||||
dune language. Please update your dune config file to have (lang dune 2.7).
|
||||
[1]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue