From d1d9fbc899be37bba7b05f31ac5c7a4d15d64811 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 4 Sep 2018 14:32:11 +0300 Subject: Rename .test/test{} to .testscript/testscript{} --- tests/new.testscript | 217 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 tests/new.testscript (limited to 'tests/new.testscript') diff --git a/tests/new.testscript b/tests/new.testscript new file mode 100644 index 0000000..abda94b --- /dev/null +++ b/tests/new.testscript @@ -0,0 +1,217 @@ +# file : tests/new.testscript +# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd +# license : MIT; see accompanying LICENSE file + +.include common.testscript + +# Disable nesting checks in the created projects. +# +test.arguments += --no-checks + +c = config.c="$recall($c.path)" +cxx = config.cxx="$recall($cxx.path)" + +status += -d prj + +: no-cfg +: +{ + # Disable amalgamation support in the created projects. + # + test.arguments += --no-amalgamation + + : exe + : + { + $* -t exe -l c++ prj-foo 2>>/"EOE" &prj-foo/***; + created new executable project prj-foo in $~/prj-foo/ + EOE + + $build prj-foo/ $cxx 2>>~%EOE% + %(c\+\+|ld) .+%{2} + EOE + } + + : lib + : + { + $* -t lib -l c++ libprj-foo 2>>/"EOE" &libprj-foo/***; + created new library project libprj-foo in $~/libprj-foo/ + EOE + + $build libprj-foo/ $cxx 2>>~%EOE% + %(version\.in|c\+\+|ar|ld) .+%{7} + EOE + } + + : exe-unit-tests + : + { + $* -t exe,unit-tests -l c++ foo 2>>/"EOE" &foo/***; + created new executable project foo in $~/foo/ + EOE + + $build foo/ $cxx 2>>~%EOE% + %(c\+\+|ld|ar) .+%{5} + EOE + } + + : lib-unit-tests + : + { + $* -t lib,unit-tests -l c++ libfoo 2>>/"EOE" &libfoo/***; + created new library project libfoo in $~/libfoo/ + EOE + + $build libfoo/ $cxx 2>>~%EOE% + %(version\.in|c\+\+|ar|ld) .+%{11} + EOE + } + + # C versions of the above. + # + : exe-c + : + { + $* -t exe -l c prj-foo 2>>/"EOE" &prj-foo/***; + created new executable project prj-foo in $~/prj-foo/ + EOE + + $build prj-foo/ $c 2>>~%EOE% + %(c|ld) .+%{2} + EOE + } + + : exe-c-unit-tests + : + { + $* -t exe,unit-tests -l c foo 2>>/"EOE" &foo/***; + created new executable project foo in $~/foo/ + EOE + + $build foo/ $c 2>>~%EOE% + %(c|ld|ar) .+%{5} + EOE + } + + # Our C tests use fmemopen() which is not always available. + # + + : lib-c + : + if ($c.target.class != 'windows' && $c.target.class != 'macos') + { + $* -t lib -l c libprj-foo 2>>/"EOE" &libprj-foo/***; + created new library project libprj-foo in $~/libprj-foo/ + EOE + + $build libprj-foo/ $c 2>>~%EOE% + %(version\.in|c|ar|ld) .+%{7} + EOE + } + + : lib-c-unit-tests + : + if ($c.target.class != 'windows' && $c.target.class != 'macos') + { + $* -t lib,unit-tests -l c libfoo 2>>/"EOE" &libfoo/***; + created new library project libfoo in $~/libfoo/ + EOE + + $build libfoo/ $c 2>>~%EOE% + %(version\.in|c|ar|ld) .+%{11} + EOE + } + + : pkg + : + { + : add + : + : Test creating a library as a separate package in the project. + : + { + $* -t empty prj 2>>/"EOE" &prj/***; + created new empty project prj in $~/prj/ + EOE + + $* --package -t lib libprj -d prj 2>>/"EOE"; + created new library package libprj in $~/prj/libprj/ + EOE + + $build prj/libprj/ $cxx 2>>~%EOE% + %(version\.in|c\+\+|ar|ld) .+%{7} + EOE + } + + : name + : + : Test that the package/project name is validated. + : + { + : package + : + $* x 2>'error: invalid package name: length is less than two characters' != 0 + + : project + : + : Here we also test that the project name is also validated as a package. + : + $* -t empty x 2>'error: invalid project name: length is less than two characters' != 0 + + : project-derived + : + $* -t empty xx &xx/*** 2>>/"EOE"; + created new empty project xx in $~/xx/ + EOE + mv xx x; + $* --package pkg -d x 2>>/"EOE" + warning: project name 'x' is invalid: length is less than two characters + info: leaving the 'project' manifest value empty + created new executable package pkg in $~/x/pkg/ + EOE + } + } +} + +: cfg +{ + : dir-and-name + : + { + $* -C prj-config @cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-config/***; + created new executable project prj in $~/prj/ + created configuration @cfg $~/prj-config/ 1 default,forwarded,auto-synchronized + synchronizing: + % new prj.+19700101000000% + EOE + + $status >'prj configured 0.1.0-a.0.19700101000000'; + + $build prj/ 2>>~%EOE% + %(mkdir|c\+\+|ld|ln) .+%{4} + EOE + } + + : name + : + : Test deducing the configuration directory path from the project source + : directory path and the configuration name. Here we also use the + : dash-prefixed name (as in Windows PowerShell where the leading '@' + : character is special). + : + { + $* -C -@cfg prj cc $cxx 2>>/~"%EOE%" &prj/*** &prj-cfg/***; + created new executable project prj in $~/prj/ + created configuration @cfg $~/prj-cfg/ 1 default,forwarded,auto-synchronized + synchronizing: + % new prj.+19700101000000% + EOE + + $status >'prj configured 0.1.0-a.0.19700101000000'; + + $build prj/ 2>>~%EOE% + %(mkdir|c\+\+|ld|ln) .+%{4} + EOE + } +} -- cgit v1.1