aboutsummaryrefslogtreecommitdiff
path: root/tests/status.testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-07-11 21:16:08 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-08-12 12:53:05 +0300
commit1ac2b1310851b3da03318797231f3832f4804c79 (patch)
treeae06ffe5409b8230f930499463b694eb96c11f1f /tests/status.testscript
parent6ecb087d239a19ccbc272a5f2333a16d4cfe9f59 (diff)
Allow using package names in commands (GH issue #355)
Diffstat (limited to 'tests/status.testscript')
-rw-r--r--tests/status.testscript179
1 files changed, 177 insertions, 2 deletions
diff --git a/tests/status.testscript b/tests/status.testscript
index 10480ac..c32ea88 100644
--- a/tests/status.testscript
+++ b/tests/status.testscript
@@ -102,8 +102,8 @@ config += -d prj 2>!
]
EOO
- $* libbar 2>>EOE;
- info: no packages initialized in configuration @cfg, skipping
+ $* libbar 2>>/"EOE" != 0;
+ error: no packages in project $~/prj/
EOE
$* --stdout-format 'json' libbar >>~%EOO%
@@ -323,3 +323,178 @@ config += -d prj 2>!
drop libprj
EOE
}
+
+: pkg-by-name
+:
+{
+ $new -t empty prj &prj/***;
+
+ $new --package pkg1 -d prj;
+ $new --package pkg2 -d prj;
+
+ $init -C @cfg $config_cxx -d prj/pkg1 &prj-cfg/***;
+
+ $new -t lib libprj &libprj/***;
+
+ cat <<EOI >+prj/repositories.manifest;
+ :
+ role: prerequisite
+ location: ../libprj
+ type: dir
+ EOI
+
+ cat <<EOI >+prj/pkg1/manifest;
+ depends: libprj
+ EOI
+
+ $sync;
+
+ # Initialized package is specified.
+ #
+ $* -d prj/pkg1 >>EOO;
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ EOO
+
+ $* pkg1 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg1",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000#1",
+ "hold_package": true,
+ "hold_version": true
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Not initialized package is specified.
+ #
+ $* pkg2 >>EOO;
+ pkg2 available 0.1.0-a.0.19700101000000
+ EOO
+
+ $* pkg2 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg2",
+ "status": "available",
+ "available_versions": [
+ {
+ "version": "0.1.0-a.0.19700101000000"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Dependency package is specified.
+ #
+ $* libprj >>EOO;
+ libprj configured 0.1.0-a.0.19700101000000
+ EOO
+
+ $* libprj --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "libprj",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Unknown dependency package is specified.
+ #
+ $* libprj1 >>EOO;
+ libprj1 unknown
+ EOO
+
+ $* libprj1 --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "libprj1",
+ "status": "unknown"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # No packages are specified.
+ #
+ $* >>EOO;
+ pkg1 configured 0.1.0-a.0.19700101000000#1
+ EOO
+
+ $* --stdout-format 'json' >>~%EOO%;
+ [
+ {
+ "configuration": {
+ "id": 1,
+ % "path": ".+prj-cfg",%
+ "name": "cfg"
+ },
+ "packages": [
+ {
+ "name": "pkg1",
+ "status": "configured",
+ "version": "0.1.0-a.0.19700101000000#1",
+ "hold_package": true,
+ "hold_version": true
+ },
+ {
+ "name": "pkg2",
+ "status": "uninitialized"
+ }
+ ]
+ }
+ ]
+ EOO
+
+ # Both initialized and dependency packages are specified.
+ #
+ $* libprj pkg1 -d prj 2>>EOE != 0;
+ error: initialized package pkg1 specified with dependency package libprj
+ EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop pkg1
+ drop libprj
+ EOE
+}