@@ -7,6 +7,10 @@ set -euo pipefail
7
7
IFS=$' \n\t '
8
8
set -x
9
9
10
+ IFS=' .-' read -ra VERSION_SPLIT <<< " $1"
11
+ declare -a allTemplates
12
+ major_version=" ${VERSION_SPLIT[0]} "
13
+
10
14
# The list of templates in each version of .NET that we want to test.
11
15
# If additional templates are found via `dotnet new --list`, this test
12
16
# will fail unless they are added here.
@@ -210,6 +214,7 @@ dotnet3Templates=(
210
214
# format: <template> <action>
211
215
# actions:
212
216
# new - just create template ( using dotnet new <template> )
217
+ # project,new - create a project, and then create this template ( using dotnet new <template> )
213
218
# build - create template and run build on it ( dotnet build )
214
219
# run - create template and run it ( dotnet run )
215
220
# test - create template and run its tests ( dotnet test )
@@ -234,8 +239,10 @@ gitignore new
234
239
globaljson new
235
240
global.json new
236
241
mstest test
242
+ mstest-class project,new
237
243
mvc build
238
244
nunit test
245
+ nunit-test new
239
246
page new
240
247
razor build
241
248
razorclasslib build
@@ -249,6 +256,9 @@ webapp build
249
256
worker build
250
257
xunit test"
251
258
259
+ template9Actions=\
260
+ " nunit-test project,new"
261
+
252
262
# Templates that can be ignored. They may be present in the dotnet new
253
263
# --list output but are safe to ignore. We we don't want to test these
254
264
# because they are known to not work on the platforms we care about.
@@ -273,6 +283,17 @@ for line in "${templateLines[@]}"; do
273
283
knownTemplateActions[" $templateName " ]=" $action "
274
284
done
275
285
286
+ templateActions=" template${major_version} Actions"
287
+ templateActions=" ${! templateActions:- } "
288
+ if [[ $templateActions != " " ]]; then
289
+ readarray -t templateLines <<< " ${templateActions}"
290
+ for line in " ${templateLines[@]} " ; do
291
+ templateName=" ${line%% * } "
292
+ action=" ${line##* } "
293
+ knownTemplateActions[" $templateName " ]=" $action "
294
+ done
295
+ fi
296
+
276
297
dotnet help > /dev/null 2> /dev/null
277
298
278
299
dotnet new --list
@@ -302,9 +323,6 @@ for template in "${allAutoTemplates[@]}"; do
302
323
fi
303
324
done
304
325
305
- IFS=' .-' read -ra VERSION_SPLIT <<< " $1"
306
- declare -a allTemplates
307
- major_version=" ${VERSION_SPLIT[0]} "
308
326
template_names=" dotnet${major_version} Templates[@]"
309
327
allTemplates=( " ${! template_names} " )
310
328
if [[ -z " $allTemplates " ]] ; then
@@ -359,6 +377,11 @@ function testTemplate {
359
377
return
360
378
fi
361
379
380
+ if [[ ${action} = project,* ]] ; then
381
+ dotnet new console 2>&1 | tee " ${templateName} .log"
382
+ action=$( echo " ${action} " | sed -E " s|project,||" )
383
+ fi
384
+
362
385
dotnet new " ${templateName} " 2>&1 | tee " ${templateName} .log"
363
386
if grep -i failed " ${templateName} .log" ; then
364
387
echo " error: ${templateName} failed."
0 commit comments