value-dt-test-YYYY-MM-DD--HH-MM: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
(Add test-fixture asserts for xunit testing)
(fix upcoming link)
 
(14 intermediate revisions by 3 users not shown)
Line 5: Line 5:
:<span class="author vcard"><span class="fn">[[User:Tantek|Tantek Çelik]]</span></span>
:<span class="author vcard"><span class="fn">[[User:Tantek|Tantek Çelik]]</span></span>


<div class="description">
<div class="summary">
== testing ==
== testing ==
[[value-class-pattern]] date and time parsing:
<span class="description">The <span class="summary">value-dt-test-YYYY-MM-DD--HH-MM</span> test demonstrate the concatenation of two html elements to create one datetime value:</span>
* YYYY-MM-DD
* YYYY-MM-DD
* HH:MM
* HH:MM
in an <span class="format">[[hCalendar]]</span> event.
in an <span class="format">[[hCalendar]]</span> event.
</div> <!-- summary -->


== markup pattern ==
== markup pattern ==
Line 24: Line 20:
  <span class="value">HH:MM</span>
  <span class="value">HH:MM</span>
</span>
</span>
</source>
and variant with intermediate span
<source lang=html4strict>
<span class="dtstart">
<span>
  <span class="value">YYYY-MM-DD</span>
  at
  <span class="value">HH:MM</span>
</span>
</span>
</source>
</source>


Similarly with <code>dtend</code>.
Similarly with <code>dtend</code>.


</div> <!-- description -->


== test ==
== test ==
Line 42: Line 50:
;Web
;Web
:<span class="url">http://microformats.org/wiki/events/2009-06-26-microformats-4th-bday</span>
:<span class="url">http://microformats.org/wiki/events/2009-06-26-microformats-4th-bday</span>
:<span class="url">http://upcoming.yahoo.com/event/3010807</span>
:<span class="url">http://upcoming.org/event/3010807</span>
;Donation
;Donation
:Donation requested at the door: sliding scale $5-$20.  
:Donation requested at the door: sliding scale $5-$20.  
</div> <!-- end vevent -->
</div> <!-- end test -->
<div class="test" id="uf2">
<div class="vevent">
;When
:<span class="dtstart"><span><span class="value">2009-06-26</span> at <span class="value">22:05</span></span></span> to <span class="dtend"><span><span class="value">2009-06-26</span> at <span class="value">23:06</span></span></span>
;Where
:<span class="location adr">Somewhere in <span class="locality">San Francisco</span>, <span class="region">CA</span>,  <span class="country-name">USA</span></span>
;What
:<span class="summary">microformats.org 4th birthday after-party!</span>
;Web
:no URL
</div> <!-- end vevent -->
</div> <!-- end vevent -->
</div> <!-- end test -->
</div> <!-- end test -->
Line 64: Line 86:
DTEND;VALUE=DATE-TIME:20090626T220000
DTEND;VALUE=DATE-TIME:20090626T220000
END:VEVENT
END:VEVENT
BEGIN:VEVENT
LOCATION;LANGUAGE=en;CHARSET=utf-8:Somewhere in San Francisco\, CA\, USA
SUMMARY;LANGUAGE=en;CHARSET=utf-8:microformats.org 4th birthday after-party!
DTSTART;VALUE=DATE-TIME:20090626T220500
DTEND;VALUE=DATE-TIME:20090626T230600
END:VEVENT
END:VCALENDAR
END:VCALENDAR
</source>
</source>
Line 74: Line 104:
DTSTART;VALUE=DATE-TIME:20090626T190000
DTSTART;VALUE=DATE-TIME:20090626T190000
DTEND;VALUE=DATE-TIME:20090626T220000
DTEND;VALUE=DATE-TIME:20090626T220000
</source>
and
<source lang=text>
DTSTART;VALUE=DATE-TIME:20090626T220500
DTEND;VALUE=DATE-TIME:20090626T230600
</source>
</source>


Line 81: Line 118:
DTSTART:20090626T190000
DTSTART:20090626T190000
DTEND:20090626T220000
DTEND:20090626T220000
</source>
and
<source lang=text>
DTSTART:20090626T220500
DTEND:20090626T230600
</source>
</source>


== Asserts ==
== Asserts ==
The table below describes a set of programming tests for XUnit testing parsers. 


    <table id="assetTable" cellpadding="0" cellspacing="0">
<table cellpadding="0" cellspacing="0" summary="Testing framework assertions used to test the parsed data against the expected data.">
   
  <caption>A set of programming tests for xUnit testing frameworks</caption> 
         <tr>
         <tr>
             <th>Test</th>
             <th>Test</th>
Line 93: Line 136:
             <th>Comment</th>
             <th>Comment</th>
         </tr>
         </tr>
 
         <tr class="assert">
         <tr class="assert">
             <td class="test">vevent[0].dtstart</td>
             <td class="test">vevent[0].dtstart</td>
             <td class="result">IsEqualToISODate("2009-06-26T19:00")</td>
             <td class="result">IsEqualToISODate("2009-06-26T19:00")</td>
             <td class="comment">With the value class pattern the results should contain a time</td>
             <td class="comment">With the value class pattern the results should contain a time</td>
         </tr>
         </tr>      
       
         <tr class="assert">
         <tr class="assert">
             <td class="test">vevent[0].dtend</td>
             <td class="test">vevent[0].dtend</td>
Line 105: Line 146:
             <td class="comment">With the value class pattern the results should contain a time</td>
             <td class="comment">With the value class pattern the results should contain a time</td>
         </tr>
         </tr>
 
        <tr class="assert">
    </table>
            <td class="test">vevent[1].dtstart</td>
 
            <td class="result">IsEqualToISODate("2009-06-26T22:05")</td>
 
            <td class="comment">With the value class pattern the results should contain a time</td>
        </tr>       
        <tr class="assert">
            <td class="test">vevent[1].dtend</td>
            <td class="result">IsEqualToISODate("2009-06-26T23:06")</td>
            <td class="comment">With the value class pattern the results should contain a time</td>
        </tr>
</table>


== results ==
== results ==
Line 115: Line 163:
** http://suda.co.uk/projects/microformats/hcalendar/get-cal.php?uri=http://microformats.org/wiki/value-dt-test-YYYY-MM-DD--HH-MM%23uf
** http://suda.co.uk/projects/microformats/hcalendar/get-cal.php?uri=http://microformats.org/wiki/value-dt-test-YYYY-MM-DD--HH-MM%23uf
** verified by [[User:Tantek]] 2009-07-06.
** verified by [[User:Tantek]] 2009-07-06.
* 2009-11-03: UfXtract has been updated to pass this test. To re-run and verify this test case try:
** http://ufxtract.com/api/?url=http://microformats.org/wiki/value-dt-test-YYYY-MM-DD--HH-MM&format=hcalendar&output=text
* 2012-01-04: Added second test case to test intermediate span.
** second test case appears to work in X2V 0.9.7, but FAIL (no time given) in Operator 0.9.5.6. [[User:Tantek|Tantek]] 20:40, 4 January 2012 (UTC)


</div><!--history -->
</div><!--history -->

Latest revision as of 05:57, 4 April 2017

One of several value class pattern date and time value test cases. Marked up with the test-fixture poshformat.

author
Tantek Çelik

testing

The value-dt-test-YYYY-MM-DD--HH-MM test demonstrate the concatenation of two html elements to create one datetime value:

  • YYYY-MM-DD
  • HH:MM

in an hCalendar event.

markup pattern

Here is the markup pattern fragment (escaped, and with abstract not real values) that is being tested:

<span class="dtstart">
 <span class="value">YYYY-MM-DD</span> 
 at
 <span class="value">HH:MM</span>
</span>

and variant with intermediate span

<span class="dtstart">
 <span>
  <span class="value">YYYY-MM-DD</span> 
  at
  <span class="value">HH:MM</span>
 </span>
</span>

Similarly with dtend.


test

hCalendar test in actual markup on the page (view or edit source to see actual hCalendar markup)

When
2009-06-26 at 19:00 to 2009-06-26 at 22:00
Where
B Restaurant and Bar, 720 Howard Street, Yerba Buena Upper Terrace, San Francisco, CA 94103 USA
What
microformats.org 4th birthday party!
Web
http://microformats.org/wiki/events/2009-06-26-microformats-4th-bday
http://upcoming.org/event/3010807
Donation
Donation requested at the door: sliding scale $5-$20.


When
2009-06-26 at 22:05 to 2009-06-26 at 23:06
Where
Somewhere in San Francisco, CA, USA
What
microformats.org 4th birthday after-party!
Web
no URL

expected iCalendar output

Here is the expected iCalendar output, omitting optional "X-" properties, and implementation specific "PRODID" property:

BEGIN:VCALENDAR
VERSION:2.0
METHOD:PUBLISH
CALSCALE:GREGORIAN
BEGIN:VEVENT
LOCATION;LANGUAGE=en;CHARSET=utf-8:B Restaurant and Bar\, 720 Howard Street\, Yerba Buena Upper Terrace\, San Francisco\, CA 94103 USA
SUMMARY;LANGUAGE=en;CHARSET=utf-8:microformats.org 4th birthday party!
URL:http://microformats.org/wiki/events/2009-06-26-microformats-4th-bday
DTSTART;VALUE=DATE-TIME:20090626T190000
DTEND;VALUE=DATE-TIME:20090626T220000
END:VEVENT

BEGIN:VEVENT
LOCATION;LANGUAGE=en;CHARSET=utf-8:Somewhere in San Francisco\, CA\, USA
SUMMARY;LANGUAGE=en;CHARSET=utf-8:microformats.org 4th birthday after-party!
DTSTART;VALUE=DATE-TIME:20090626T220500
DTEND;VALUE=DATE-TIME:20090626T230600
END:VEVENT

END:VCALENDAR

The key lines that an hCalendar to iCalendar converter must match in order to pass this test:

DTSTART;VALUE=DATE-TIME:20090626T190000
DTEND;VALUE=DATE-TIME:20090626T220000

and

DTSTART;VALUE=DATE-TIME:20090626T220500
DTEND;VALUE=DATE-TIME:20090626T230600

Acceptable variant:

DTSTART:20090626T190000
DTEND:20090626T220000

and

DTSTART:20090626T220500
DTEND:20090626T230600

Asserts

A set of programming tests for xUnit testing frameworks
Test Result Comment
vevent[0].dtstart IsEqualToISODate("2009-06-26T19:00") With the value class pattern the results should contain a time
vevent[0].dtend IsEqualToISODate("2009-06-26T22:00") With the value class pattern the results should contain a time
vevent[1].dtstart IsEqualToISODate("2009-06-26T22:05") With the value class pattern the results should contain a time
vevent[1].dtend IsEqualToISODate("2009-06-26T23:06") With the value class pattern the results should contain a time

results

  • 2012-01-04: Added second test case to test intermediate span.
    • second test case appears to work in X2V 0.9.7, but FAIL (no time given) in Operator 0.9.5.6. Tantek 20:40, 4 January 2012 (UTC)

derivation

This test was derived from events/2009-06-26-microformats-4th-bday which used the hCard defined value-excerption-pattern to provide more readable and accessible date and time information.

see also