| garciadeblas | 83775ba | 2025-07-23 18:35:24 +0200 | [diff] [blame] | 1 | #!/usr/bin/env -S nu --stdin |
| 2 | ####################################################################################### |
| 3 | # Copyright ETSI Contributors and Others. |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 14 | # implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | ####################################################################################### |
| 18 | |
| 19 | |
| 20 | use std assert |
| 21 | # use ../../krm * |
| 22 | |
| 23 | use ./location.nu * |
| 24 | use ./app.nu * |
| 25 | # use ./ksu.nu * |
| 26 | # use ./pattern.nu * |
| 27 | # use ./brick.nu * |
| 28 | |
| 29 | |
| 30 | # Test launcher |
| 31 | def main [] { |
| 32 | print "Running tests..." |
| 33 | |
| 34 | let test_commands: list<string> = ( |
| 35 | scope commands |
| 36 | | where ($it.type == "custom") |
| 37 | and ($it.name | str starts-with "test ") |
| 38 | and not ($it.description | str starts-with "ignore") |
| 39 | | get name |
| 40 | ) |
| 41 | |
| 42 | let count_test_commands: int = ($test_commands | length) |
| 43 | let test_commands_together: string = ( |
| 44 | $test_commands |
| 45 | | enumerate |
| 46 | | each { |test| |
| 47 | [$"print '--> [($test.index + 1)/($count_test_commands)] ($test.item)'", $test.item] |
| 48 | } |
| 49 | | flatten |
| 50 | | str join ";" |
| 51 | ) |
| 52 | |
| 53 | nu --commands $"source `($env.CURRENT_FILE)`; ($test_commands_together)" |
| 54 | print $"\n✅ ALL TESTS COMPLETED SUCCESSFULLY" |
| 55 | } |