curl-curl/tests/data/test646
Viktor Szakats 3d42510118
runtests: allow client/command to span multiple lines, and use it
Some curl command-lines are long, often repetitive, and difficult
to read or write:

Before this patch (1 test == 1 line):
- <=78 characters: 1099 tests
- 79-132 characters: 500 tests
- 133+ characters: 217 tests: patch meant to help with some of these.

After this patch:
- <=78 characters: 1288 lines
- 79-132 characters: 526 lines
- 133+ characters: 190 lines

After this patch it's possible to fold long lines into multiple ones.
Folding can reduce greppability, thus this is primarily useful for cases
when the options are repetitive, e.g. a list of form options, headers,
mail parameters and the like.

Closes #19500
2025-11-13 01:05:01 +01:00

112 lines
2.5 KiB
Plaintext

<testcase>
<info>
<keywords>
SMTP
MULTIPART
</keywords>
</info>
#
# Server-side
<reply>
</reply>
#
# Client-side
<client>
<features>
Mime
</features>
<server>
smtp
</server>
<name>
SMTP multipart using mime API
</name>
<stdin crlf="yes">
From: different
To: another
body
</stdin>
<command>
smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER
--mail-rcpt recipient@example.com
--mail-from sender@example.com
-F "=(;type=multipart/alternative"
-F "= <body>This is the html version</body>;headers=X-test1: this is a header;type=text/html;headers=X-test2: this is another header "
-F "=This is the plain text version;headers=@%LOGDIR/headers%TESTNUMBER"
-F "=)"
-F "=@%LOGDIR/test%TESTNUMBER.txt;headers=<%LOGDIR/headers%TESTNUMBER"
-H "From: different"
-H "To: another"
-H "Reply-To: <followup@example.com>"
</command>
<file1 name="%LOGDIR/test%TESTNUMBER.txt">
This is an attached file.
It may contain any type of data.
</file1>
<file2 name="%LOGDIR/headers%TESTNUMBER">
# This line is a comment
X-fileheader1: This is a header from a file%SP%CR
# This line is another comment. It precedes a folded header.
X-fileheader2: This is #a
folded header
</file2>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strippart>
s/^--------------------------[A-Za-z0-9]*/------------------------------/
s/boundary=------------------------[A-Za-z0-9]*/boundary=----------------------------/
</strippart>
<protocol crlf="yes">
EHLO %TESTNUMBER
MAIL FROM:<sender@example.com>
RCPT TO:<recipient@example.com>
DATA
QUIT
</protocol>
<upload>
Content-Type: multipart/mixed; boundary=----------------------------%CR
Mime-Version: 1.0%CR
From: different%CR
To: another%CR
Reply-To: <followup@example.com>%CR
%CR
------------------------------%CR
Content-Type: multipart/alternative; boundary=----------------------------%CR
%CR
------------------------------%CR
Content-Type: text/html%CR
Content-Transfer-Encoding: 8bit%CR
X-test1: this is a header%CR
X-test2: this is another header%CR
%CR
<body>This is the html version</body>%CR
------------------------------%CR
X-fileheader1: This is a header from a file%CR
X-fileheader2: This is #a folded header%CR
%CR
This is the plain text version%CR
--------------------------------%CR
%CR
------------------------------%CR
Content-Disposition: attachment; filename="test%TESTNUMBER.txt"%CR
X-fileheader1: This is a header from a file%CR
X-fileheader2: This is #a folded header%CR
%CR
This is an attached file.
It may contain any type of data.
%CR
--------------------------------%CR
.%CR
</upload>
</verify>
</testcase>