Index: test/intl/date-format/parse-mdyhms.js |
diff --git a/src/extensions/i18n/i18n-extension.h b/test/intl/date-format/parse-mdyhms.js |
similarity index 64% |
copy from src/extensions/i18n/i18n-extension.h |
copy to test/intl/date-format/parse-mdyhms.js |
index 050c336a67a21fd6cb32892e14215cac11971111..2928262c8d9e66c222e74b8df6d6d9bff156782d 100644 |
--- a/src/extensions/i18n/i18n-extension.h |
+++ b/test/intl/date-format/parse-mdyhms.js |
@@ -26,26 +26,27 @@ |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// limitations under the License. |
-#ifndef V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
-#define V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
+// Testing v8Parse method for date and time pattern. |
-#include "v8.h" |
+var dtf = new Intl.DateTimeFormat(['en'], |
+ {year: 'numeric', month: 'numeric', |
+ day: 'numeric', hour: 'numeric', |
+ minute: 'numeric', second: 'numeric'}); |
-namespace v8_i18n { |
+// Make sure we have pattern we expect (may change in the future). |
+assertEquals('M/d/y h:mm:ss a', dtf.resolved.pattern); |
-class Extension : public v8::Extension { |
- public: |
- Extension(); |
+assertEquals('Sat May 04 1974 12:30:12 GMT-0007 (PDT)', |
+ usePDT(String(dtf.v8Parse('5/4/74 12:30:12 pm')))); |
- virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( |
- v8::Handle<v8::String> name); |
+// AM/PM were not specified. |
+assertEquals(undefined, dtf.v8Parse('5/4/74 12:30:12')); |
- static void Register(); |
+// Time was not specified. |
+assertEquals(undefined, dtf.v8Parse('5/4/74')); |
- private: |
- static Extension* extension_; |
-}; |
+// Month is numeric, so it fails on "May". |
+assertEquals(undefined, dtf.v8Parse('May 4th 1974')); |
-} // namespace v8_i18n |
- |
-#endif // V8_EXTENSIONS_I18N_I18N_EXTENSION_H_ |
+// Wrong date delimiter. |
+assertEquals(undefined, dtf.v8Parse('5-4-74 12:30:12 am')); |