2025-03-16 12:15:34 +01:00
|
|
|
# Test 29 - Gestion des variables non définies
|
|
|
|
|
|
|
|
Ce test vérifie comment `bake` et `make` réagissent lorsqu'une variable non définie est utilisée dans une commande.
|
|
|
|
|
|
|
|
## Sommaire
|
|
|
|
- [Structure du test](#structure-du-test)
|
|
|
|
- [Contenu des fichiers de règles](#contenu-des-fichiers-de-règles)
|
|
|
|
- [Objectif du test](#objectif-du-test)
|
|
|
|
- [Scénario de test](#scénario-de-test)
|
|
|
|
- [Comment exécuter le test](#comment-exécuter-le-test)
|
|
|
|
- [Test manuel](#test-manuel)
|
|
|
|
- [Résultats attendus](#résultats-attendus)
|
|
|
|
|
|
|
|
## Structure du test
|
|
|
|
|
|
|
|
```
|
|
|
|
test-29-variable-missing/
|
|
|
|
├── README.md
|
|
|
|
├── bake/
|
|
|
|
│ ├── Bakefile
|
|
|
|
│ ├── bakefile.jar
|
|
|
|
├── make/
|
|
|
|
│ ├── Makefile
|
|
|
|
└── run_test29.sh
|
|
|
|
```
|
|
|
|
|
|
|
|
## Contenu des fichiers de règles
|
|
|
|
|
|
|
|
```makefile
|
|
|
|
NOM_FICHIER = test.txt
|
|
|
|
|
|
|
|
main:
|
|
|
|
@echo "Création du fichier"
|
|
|
|
touch $(NOM_FICHIER)
|
|
|
|
@echo "Essai de création d'un fichier avec une variable qui n'existe pas"
|
|
|
|
touch $(NOM_FICHIER2)
|
|
|
|
```
|
|
|
|
|
|
|
|
## Objectif du test
|
|
|
|
|
|
|
|
Ce test vérifie :
|
|
|
|
1. Si `bake` et `make` détectent l'utilisation d'une variable non définie (`NOM_FICHIER2`).
|
|
|
|
2. Si une erreur est affichée.
|
|
|
|
|
|
|
|
## Scénario de test
|
|
|
|
|
|
|
|
1. Exécuter `make` et `bake` pour voir la gestion de la variable manquante.
|
|
|
|
|
|
|
|
## Test manuel
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd make
|
|
|
|
make
|
|
|
|
|
|
|
|
cd bake
|
|
|
|
java -cp bakefile.jar fr.monlouyan.bakefile.Main
|
|
|
|
```
|
|
|
|
|
|
|
|
## Résultats attendus
|
|
|
|
|
|
|
|
- `bake` et `make` doivent afficher une erreur pour `NOM_FICHIER2` car elle n'est pas définie.
|