{
FILE *fp = data;
fprintf(fp, "[bundle \"%s\"]\n", info->id);
- fprintf(fp, "\turi = %s\n", info->uri);
+ if (info->uri)
+ fprintf(fp, "\turi = %s\n", info->uri);
+ else
+ fprintf(fp, "\t# uri = (missing)\n");
if (info->creationToken)
fprintf(fp, "\tcreationToken = %"PRIu64"\n", info->creationToken);
result = 1;
}
+ if (!result) {
+ struct hashmap_iter iter;
+ struct remote_bundle_info *bundle;
+
+ hashmap_for_each_entry(&list->bundles, &iter, bundle, ent) {
+ if (!bundle->uri) {
+ error(_("bundle list at '%s': bundle '%s' has no uri"),
+ uri, bundle->id ? bundle->id : "<unknown>");
+ result = 1;
+ }
+ }
+ }
+
return result;
}
return -1;
}
+ if (!bundle->uri) {
+ error(_("bundle '%s' has no uri"),
+ bundle->id ? bundle->id : "<unknown>");
+ return -1;
+ }
+
if (!bundle->file &&
!(bundle->file = find_temp_filename())) {
result = -1;
grep "could not parse bundle list key creationToken with value '\''bogus'\''" err
'
+test_expect_success 'parse config format: bundle with missing uri' '
+ cat >input <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "missing-uri"]
+ creationToken = 1
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-config input 2>err &&
+ grep "bundle '\''missing-uri'\'' has no uri" err
+'
+
+test_expect_success 'parse config format: bundle with url instead of uri' '
+ cat >input <<-\EOF &&
+ [bundle]
+ version = 1
+ mode = all
+ [bundle "typo"]
+ url = https://example.com/bundle.bdl
+ EOF
+
+ test_must_fail test-tool bundle-uri parse-config input 2>err &&
+ grep "bundle '\''typo'\'' has no uri" err
+'
+
test_done