tests: Add tests for MODIFY-SERVICES procedure
* tests/services.scm ("modify-services: do nothing")
("modify-services: delete service")
("modify-services: change value"): New tests.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
			
			
This commit is contained in:
		
							parent
							
								
									decf5fed65
								
							
						
					
					
						commit
						09fcf261c1
					
				
					 1 changed files with 50 additions and 0 deletions
				
			
		|  | @ -286,4 +286,54 @@ | |||
|          ((one) one) | ||||
|          (x x)))) | ||||
| 
 | ||||
| (test-equal "modify-services: do nothing" | ||||
|   '(1 2 3) | ||||
|   (let* ((t1 (service-type (name 't1) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t2 (service-type (name 't2) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t3 (service-type (name 't3) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (services (list (service t1 1) (service t2 2) (service t3 3)))) | ||||
|     (sort (map service-value | ||||
|                (modify-services services)) | ||||
|           <))) | ||||
| 
 | ||||
| (test-equal "modify-services: delete service" | ||||
|   '(1 3) | ||||
|   (let* ((t1 (service-type (name 't1) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t2 (service-type (name 't2) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t3 (service-type (name 't3) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (services (list (service t1 1) (service t2 2) (service t3 3)))) | ||||
|     (sort (map service-value | ||||
|                (modify-services services | ||||
|                  (delete t2))) | ||||
|           <))) | ||||
| 
 | ||||
| (test-equal "modify-services: change value" | ||||
|   '(1 2 33) | ||||
|   (let* ((t1 (service-type (name 't1) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t2 (service-type (name 't2) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (t3 (service-type (name 't3) | ||||
|                            (extensions '()) | ||||
|                            (description ""))) | ||||
|          (services (list (service t1 1) (service t2 2) (service t3 3)))) | ||||
|     (sort (map service-value | ||||
|                (modify-services services | ||||
|                  (t3 value => 33))) | ||||
|           <))) | ||||
| 
 | ||||
| (test-end) | ||||
|  |  | |||
		Reference in a new issue