content_type stringclasses 8 values | main_lang stringclasses 7 values | message stringlengths 1 50 | sha stringlengths 40 40 | patch stringlengths 52 962k | file_count int64 1 300 |
|---|---|---|---|---|---|
PHP | PHP | update patchentity docs to be correct | f51889238a56587b69b2bf7f02c90ce55e7e28aa | <ide><path>src/ORM/Table.php
<ide> public function marshaller()
<ide> *
<ide> * ```
<ide> * $article = $this->Articles->newEntity($this->request->data(), [
<del> * 'fieldList' => ['title', 'body'],
<add> * 'fieldList' => ['title', 'body', 'tags', 'comments'],
<ide> * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
<ide> * ]
<ide> * );
<ide> public function newEntity($data = null, array $options = [])
<ide> *
<ide> * ```
<ide> * $articles = $this->Articles->newEntities($this->request->data(), [
<del> * 'fieldList' => ['title', 'body'],
<add> * 'fieldList' => ['title', 'body', 'tags', 'comments'],
<ide> * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
<ide> * ]
<ide> * );
<ide> public function newEntities(array $data, array $options = [])
<ide> *
<ide> * ```
<ide> * $article = $this->Articles->patchEntity($article, $this->request->data(), [
<del> * 'fieldList' => ['title', 'body'],
<add> * 'fieldList' => ['title', 'body', 'tags', 'comments],
<ide> * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
<ide> * ]
<ide> * );
<ide> public function patchEntity(EntityInterface $entity, array $data, array $options
<ide> *
<ide> * ```
<ide> * $articles = $this->Articles->patchEntities($articles, $this->request->data(), [
<del> * 'fieldList' => ['title', 'body'],
<add> * 'fieldList' => ['title', 'body', 'tags', 'comments'],
<ide> * 'associated' => ['Tags', 'Comments.Users' => ['fieldList' => 'username']]
<ide> * ]
<ide> * ); | 1 |
Python | Python | add weighted_metrics to saved model config | e06e8a96d5adef8610d682c758ee080a13011eca | <ide><path>keras/engine/saving.py
<ide> def get_json_type(obj):
<ide> },
<ide> 'loss': model.loss,
<ide> 'metrics': model.metrics,
<add> 'weighted_metrics': model.weighted_metrics,
<ide> 'sample_weight_mode': model.sample_weight_mode,
<ide> 'loss_weights': model.loss_weights,
<ide> }, default=get_json_type).encode('utf8') | 1 |
Text | Text | add zendesk as a company which is using airflow | b5761d5b162b17e686cade1677c78e5e32103e0e | <ide><path>README.md
<ide> Currently **officially** using Airflow:
<ide> * Xoom [[@gepser](https://github.com/gepser) & [@omarvides](https://github.com/omarvides)]
<ide> * [WePay](http://www.wepay.com) [[@criccomini](https://github.com/criccomini) & [@mtagle](https://github.com/mtagle)]
<ide> * Yahoo!
<add>* [Zendesk](https://www.github.com/zendesk)
<ide>
<ide> ## Links
<ide> | 1 |
Javascript | Javascript | add css tokenizer | aa842de140b5fa56fd4839c40b94c45f491b4d08 | <ide><path>lib/css/walkCssTokens.js
<add>/*
<add> MIT License http://www.opensource.org/licenses/mit-license.php
<add> Author Tobias Koppers @sokra
<add>*/
<add>
<add>"use strict";
<add>
<add>/**
<add> * @typedef {Object} CssTokenCallbacks
<add> * @property {function(string, number, number, number, number): number=} url
<add> * @property {function(string, number, number): number=} leftParenthesis
<add> * @property {function(string, number, number): number=} rightParenthesis
<add> * @property {function(string, number, number): number=} pseudoFunction
<add> * @property {function(string, number, number): number=} pseudoClass
<add> * @property {function(string, number, number): number=} class
<add> * @property {function(string, number, number): number=} identifier
<add> * @property {function(string, number, number): number=} id
<add> * @property {function(string, number, number): number=} leftCurlyBracket
<add> * @property {function(string, number, number): number=} rightCurlyBracket
<add> * @property {function(string, number, number): number=} semicolon
<add> * @property {function(string, number, number): number=} comma
<add> */
<add>
<add>/** @typedef {function(string, number, CssTokenCallbacks): number} CharHandler */
<add>
<add>// spec: https://drafts.csswg.org/css-syntax/
<add>
<add>const CC_LINE_FEED = "\n".charCodeAt(0);
<add>const CC_CARRIAGE_RETURN = "\r".charCodeAt(0);
<add>const CC_FORM_FEED = "\f".charCodeAt(0);
<add>
<add>const CC_TAB = "\t".charCodeAt(0);
<add>const CC_SPACE = " ".charCodeAt(0);
<add>
<add>const CC_SLASH = "/".charCodeAt(0);
<add>const CC_BACK_SLASH = "\\".charCodeAt(0);
<add>const CC_ASTERISK = "*".charCodeAt(0);
<add>
<add>const CC_LEFT_PARENTHESIS = "(".charCodeAt(0);
<add>const CC_RIGHT_PARENTHESIS = ")".charCodeAt(0);
<add>const CC_LEFT_CURLY = "{".charCodeAt(0);
<add>const CC_RIGHT_CURLY = "}".charCodeAt(0);
<add>
<add>const CC_QUOTATION_MARK = '"'.charCodeAt(0);
<add>const CC_APOSTROPHE = "'".charCodeAt(0);
<add>
<add>const CC_FULL_STOP = ".".charCodeAt(0);
<add>const CC_COLON = ":".charCodeAt(0);
<add>const CC_SEMICOLON = ";".charCodeAt(0);
<add>const CC_COMMA = ",".charCodeAt(0);
<add>const CC_PERCENTAGE = "%".charCodeAt(0);
<add>const CC_AT_SIGN = "@".charCodeAt(0);
<add>
<add>const CC_LOW_LINE = "_".charCodeAt(0);
<add>const CC_LOWER_A = "a".charCodeAt(0);
<add>const CC_LOWER_U = "u".charCodeAt(0);
<add>const CC_LOWER_E = "e".charCodeAt(0);
<add>const CC_LOWER_Z = "z".charCodeAt(0);
<add>const CC_UPPER_A = "A".charCodeAt(0);
<add>const CC_UPPER_E = "E".charCodeAt(0);
<add>const CC_UPPER_Z = "Z".charCodeAt(0);
<add>const CC_0 = "0".charCodeAt(0);
<add>const CC_9 = "9".charCodeAt(0);
<add>
<add>const CC_NUMBER_SIGN = "#".charCodeAt(0);
<add>const CC_PLUS_SIGN = "+".charCodeAt(0);
<add>const CC_HYPHEN_MINUS = "-".charCodeAt(0);
<add>
<add>const CC_LESS_THAN_SIGN = "<".charCodeAt(0);
<add>const CC_GREATER_THAN_SIGN = ">".charCodeAt(0);
<add>
<add>const _isNewLine = cc => {
<add> return (
<add> cc === CC_LINE_FEED || cc === CC_CARRIAGE_RETURN || cc === CC_FORM_FEED
<add> );
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeSpace = (input, pos, callbacks) => {
<add> let cc;
<add> do {
<add> pos++;
<add> cc = input.charCodeAt(pos);
<add> } while (_isWhiteSpace(cc));
<add> return pos;
<add>};
<add>
<add>const _isWhiteSpace = cc => {
<add> return (
<add> cc === CC_LINE_FEED ||
<add> cc === CC_CARRIAGE_RETURN ||
<add> cc === CC_FORM_FEED ||
<add> cc === CC_TAB ||
<add> cc === CC_SPACE
<add> );
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeSingleCharToken = (input, pos, callbacks) => {
<add> return pos + 1;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumePotentialComment = (input, pos, callbacks) => {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> let cc = input.charCodeAt(pos);
<add> if (cc !== CC_ASTERISK) return pos;
<add> pos++;
<add> for (;;) {
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> while (cc === CC_ASTERISK) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> if (cc === CC_SLASH) return pos + 1;
<add> }
<add> }
<add>};
<add>
<add>/** @type {function(number): CharHandler} */
<add>const consumeString = end => (input, pos, callbacks) => {
<add> return _consumeString(input, pos, end);
<add>};
<add>
<add>const _consumeString = (input, pos, end) => {
<add> pos++;
<add> for (;;) {
<add> if (pos === input.length) return pos;
<add> const cc = input.charCodeAt(pos);
<add> if (cc === end) return pos + 1;
<add> if (_isNewLine(cc)) {
<add> // bad string
<add> return pos;
<add> }
<add> if (cc === CC_BACK_SLASH) {
<add> // we don't need to fully parse the escaped code point
<add> // just skip over a potential new line
<add> pos++;
<add> if (pos === input.length) return pos;
<add> pos++;
<add> } else {
<add> pos++;
<add> }
<add> }
<add>};
<add>
<add>const _isIdentifierStartCode = cc => {
<add> return (
<add> cc === CC_LOW_LINE ||
<add> (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
<add> (cc >= CC_UPPER_A && cc <= CC_UPPER_Z) ||
<add> cc > 0x80
<add> );
<add>};
<add>
<add>const _isDigit = cc => {
<add> return cc >= CC_0 && cc <= CC_9;
<add>};
<add>
<add>const _startsIdentifier = (input, pos) => {
<add> const cc = input.charCodeAt(pos);
<add> if (cc === CC_HYPHEN_MINUS) {
<add> if (pos === input.length) return false;
<add> const cc = input.charCodeAt(pos + 1);
<add> if (cc === CC_HYPHEN_MINUS) return true;
<add> if (cc === CC_BACK_SLASH) {
<add> const cc = input.charCodeAt(pos + 2);
<add> return !_isNewLine(cc);
<add> }
<add> return _isIdentifierStartCode(cc);
<add> }
<add> if (cc === CC_BACK_SLASH) {
<add> const cc = input.charCodeAt(pos + 1);
<add> return !_isNewLine(cc);
<add> }
<add> return _isIdentifierStartCode(cc);
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeNumberSign = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos++;
<add> if (pos === input.length) return pos;
<add> if (_startsIdentifier(input, pos)) {
<add> pos = _consumeIdentifier(input, pos);
<add> if (callbacks.id !== undefined) {
<add> return callbacks.id(input, start, pos);
<add> }
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeMinus = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos++;
<add> if (pos === input.length) return pos;
<add> const cc = input.charCodeAt(pos);
<add> if (cc === CC_FULL_STOP || _isDigit(cc)) {
<add> return consumeNumericToken(input, pos, callbacks);
<add> } else if (cc === CC_HYPHEN_MINUS) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> const cc = input.charCodeAt(pos);
<add> if (cc === CC_GREATER_THAN_SIGN) {
<add> return pos + 1;
<add> } else {
<add> pos = _consumeIdentifier(input, pos);
<add> if (callbacks.identifier !== undefined) {
<add> return callbacks.identifier(input, start, pos);
<add> }
<add> }
<add> } else if (cc === CC_BACK_SLASH) {
<add> if (pos + 1 === input.length) return pos;
<add> const cc = input.charCodeAt(pos + 1);
<add> if (_isNewLine(cc)) return pos;
<add> pos = _consumeIdentifier(input, pos);
<add> if (callbacks.identifier !== undefined) {
<add> return callbacks.identifier(input, start, pos);
<add> }
<add> } else if (_isIdentifierStartCode(cc)) {
<add> pos++;
<add> pos = _consumeIdentifier(input, pos);
<add> if (callbacks.identifier !== undefined) {
<add> return callbacks.identifier(input, start, pos);
<add> }
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeDot = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos++;
<add> if (pos === input.length) return pos;
<add> const cc = input.charCodeAt(pos);
<add> if (_isDigit(cc)) return consumeNumericToken(input, pos - 2, callbacks);
<add> if (!_startsIdentifier(input, pos)) return pos;
<add> pos = _consumeIdentifier(input, pos);
<add> if (callbacks.class !== undefined) return callbacks.class(input, start, pos);
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeNumericToken = (input, pos, callbacks) => {
<add> pos = _consumeNumber(input, pos);
<add> if (pos === input.length) return pos;
<add> if (_startsIdentifier(input, pos)) return _consumeIdentifier(input, pos);
<add> const cc = input.charCodeAt(pos);
<add> if (cc === CC_PERCENTAGE) return pos + 1;
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeOtherIdentifier = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos = _consumeIdentifier(input, pos);
<add> // we could check for CC_LEFT_PARENTHESIS here,
<add> // but we don't need that info
<add> if (callbacks.identifier !== undefined) {
<add> return callbacks.identifier(input, start, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumePotentialUrl = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos = _consumeIdentifier(input, pos);
<add> if (pos === start + 3 && input.slice(start, pos + 1) === "url(") {
<add> pos++;
<add> let cc = input.charCodeAt(pos);
<add> while (_isWhiteSpace(cc)) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> if (cc === CC_QUOTATION_MARK || cc === CC_APOSTROPHE) {
<add> pos++;
<add> const contentStart = pos;
<add> pos = _consumeString(input, pos, cc);
<add> const contentEnd = pos - 1;
<add> cc = input.charCodeAt(pos);
<add> while (_isWhiteSpace(cc)) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> if (cc !== CC_RIGHT_PARENTHESIS) return pos;
<add> pos++;
<add> if (callbacks.url !== undefined)
<add> return callbacks.url(input, start, pos, contentStart, contentEnd);
<add> return pos;
<add> } else {
<add> const contentStart = pos;
<add> let contentEnd;
<add> for (;;) {
<add> if (cc === CC_BACK_SLASH) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> pos++;
<add> } else if (_isWhiteSpace(cc)) {
<add> contentEnd = pos;
<add> do {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> } while (_isWhiteSpace(cc));
<add> if (cc !== CC_RIGHT_PARENTHESIS) return pos;
<add> pos++;
<add> if (callbacks.url !== undefined) {
<add> return callbacks.url(input, start, pos, contentStart, contentEnd);
<add> }
<add> return pos;
<add> } else if (cc === CC_RIGHT_PARENTHESIS) {
<add> pos++;
<add> if (callbacks.url !== undefined) {
<add> return callbacks.url(input, start, pos, contentStart, contentEnd);
<add> }
<add> return pos;
<add> } else if (cc === CC_LEFT_PARENTHESIS) {
<add> return pos;
<add> } else {
<add> pos++;
<add> }
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> }
<add> } else {
<add> if (callbacks.identifier !== undefined) {
<add> return callbacks.identifier(input, start, pos);
<add> }
<add> return pos;
<add> }
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumePotentialPseudo = (input, pos, callbacks) => {
<add> const start = pos;
<add> pos++;
<add> if (!_startsIdentifier(input, pos)) return pos;
<add> pos = _consumeIdentifier(input, pos);
<add> let cc = input.charCodeAt(pos);
<add> if (cc === CC_LEFT_PARENTHESIS) {
<add> pos++;
<add> if (callbacks.pseudoFunction !== undefined) {
<add> return callbacks.pseudoFunction(input, start, pos);
<add> }
<add> return pos;
<add> }
<add> if (callbacks.pseudoClass !== undefined) {
<add> return callbacks.pseudoClass(input, start, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeLeftParenthesis = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.leftParenthesis !== undefined) {
<add> return callbacks.leftParenthesis(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeRightParenthesis = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.rightParenthesis !== undefined) {
<add> return callbacks.rightParenthesis(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeLeftCurlyBracket = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.leftCurlyBracket !== undefined) {
<add> return callbacks.leftCurlyBracket(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeRightCurlyBracket = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.rightCurlyBracket !== undefined) {
<add> return callbacks.rightCurlyBracket(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeSemicolon = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.semicolon !== undefined) {
<add> return callbacks.semicolon(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeComma = (input, pos, callbacks) => {
<add> pos++;
<add> if (callbacks.comma !== undefined) {
<add> return callbacks.comma(input, pos - 1, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>const _consumeIdentifier = (input, pos) => {
<add> for (;;) {
<add> const cc = input.charCodeAt(pos);
<add> if (cc === CC_BACK_SLASH) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> pos++;
<add> } else if (
<add> _isIdentifierStartCode(cc) ||
<add> _isDigit(cc) ||
<add> cc === CC_HYPHEN_MINUS
<add> ) {
<add> pos++;
<add> } else {
<add> return pos;
<add> }
<add> }
<add>};
<add>
<add>const _consumeNumber = (input, pos) => {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> let cc = input.charCodeAt(pos);
<add> while (_isDigit(cc)) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> if (cc === CC_FULL_STOP && pos + 1 !== input.length) {
<add> const next = input.charCodeAt(pos + 1);
<add> if (_isDigit(next)) {
<add> pos += 2;
<add> cc = input.charCodeAt(pos);
<add> while (_isDigit(cc)) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> }
<add> }
<add> if (cc === CC_LOWER_E || cc === CC_UPPER_E) {
<add> if (pos + 1 !== input.length) {
<add> const next = input.charCodeAt(pos + 2);
<add> if (_isDigit(next)) {
<add> pos += 2;
<add> } else if (
<add> (next === CC_HYPHEN_MINUS || next === CC_PLUS_SIGN) &&
<add> pos + 2 !== input.length
<add> ) {
<add> const next = input.charCodeAt(pos + 2);
<add> if (_isDigit(next)) {
<add> pos += 3;
<add> } else {
<add> return pos;
<add> }
<add> } else {
<add> return pos;
<add> }
<add> }
<add> } else {
<add> return pos;
<add> }
<add> cc = input.charCodeAt(pos);
<add> while (_isDigit(cc)) {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> cc = input.charCodeAt(pos);
<add> }
<add> return pos;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeLessThan = (input, pos, callbacks) => {
<add> if (input.slice(pos + 1, pos + 4) === "!--") return pos + 4;
<add> return pos + 1;
<add>};
<add>
<add>/** @type {CharHandler} */
<add>const consumeAt = (input, pos, callbacks) => {
<add> pos++;
<add> if (pos === input.length) return pos;
<add> if (_startsIdentifier(input, pos)) {
<add> return _consumeIdentifier(input, pos);
<add> }
<add> return pos;
<add>};
<add>
<add>const CHAR_MAP = Array.from({ length: 0x80 }, (_, cc) => {
<add> // https://drafts.csswg.org/css-syntax/#consume-token
<add> switch (cc) {
<add> case CC_LINE_FEED:
<add> case CC_CARRIAGE_RETURN:
<add> case CC_FORM_FEED:
<add> case CC_TAB:
<add> case CC_SPACE:
<add> return consumeSpace;
<add> case CC_QUOTATION_MARK:
<add> case CC_APOSTROPHE:
<add> return consumeString(cc);
<add> case CC_NUMBER_SIGN:
<add> return consumeNumberSign;
<add> case CC_SLASH:
<add> return consumePotentialComment;
<add> // case CC_LEFT_SQUARE:
<add> // case CC_RIGHT_SQUARE:
<add> // case CC_COMMA:
<add> // case CC_COLON:
<add> // return consumeSingleCharToken;
<add> case CC_COMMA:
<add> return consumeComma;
<add> case CC_SEMICOLON:
<add> return consumeSemicolon;
<add> case CC_LEFT_PARENTHESIS:
<add> return consumeLeftParenthesis;
<add> case CC_RIGHT_PARENTHESIS:
<add> return consumeRightParenthesis;
<add> case CC_LEFT_CURLY:
<add> return consumeLeftCurlyBracket;
<add> case CC_RIGHT_CURLY:
<add> return consumeRightCurlyBracket;
<add> case CC_COLON:
<add> return consumePotentialPseudo;
<add> case CC_PLUS_SIGN:
<add> return consumeNumericToken;
<add> case CC_FULL_STOP:
<add> return consumeDot;
<add> case CC_HYPHEN_MINUS:
<add> return consumeMinus;
<add> case CC_LESS_THAN_SIGN:
<add> return consumeLessThan;
<add> case CC_AT_SIGN:
<add> return consumeAt;
<add> case CC_LOWER_U:
<add> return consumePotentialUrl;
<add> case CC_LOW_LINE:
<add> return consumeOtherIdentifier;
<add> default:
<add> if (_isDigit(cc)) return consumeNumericToken;
<add> if (
<add> (cc >= CC_LOWER_A && cc <= CC_LOWER_Z) ||
<add> (cc >= CC_UPPER_A && cc <= CC_UPPER_Z)
<add> ) {
<add> return consumeOtherIdentifier;
<add> }
<add> return consumeSingleCharToken;
<add> }
<add>});
<add>
<add>/**
<add> * @param {string} input input css
<add> * @param {CssTokenCallbacks} callbacks callbacks
<add> * @returns {void}
<add> */
<add>module.exports = (input, callbacks) => {
<add> let pos = 0;
<add> while (pos < input.length) {
<add> const cc = input.charCodeAt(pos);
<add> if (cc < 0x80) {
<add> pos = CHAR_MAP[cc](input, pos, callbacks);
<add> } else {
<add> pos++;
<add> }
<add> }
<add>};
<ide><path>test/walkCssTokens.unittest.js
<add>const walkCssTokens = require("../lib/css/walkCssTokens");
<add>
<add>describe("walkCssTokens", () => {
<add> const test = (name, content, fn) => {
<add> it(`should ${name}`, () => {
<add> const results = [];
<add> walkCssTokens(content, {
<add> url: (input, s, e, cs, ce) => {
<add> results.push(["url", input.slice(s, e), input.slice(cs, ce)]);
<add> return e;
<add> },
<add> leftCurlyBracket: (input, s, e) => {
<add> results.push(["leftCurlyBracket", input.slice(s, e)]);
<add> return e;
<add> },
<add> rightCurlyBracket: (input, s, e) => {
<add> results.push(["rightCurlyBracket", input.slice(s, e)]);
<add> return e;
<add> },
<add> leftParenthesis: (input, s, e) => {
<add> results.push(["leftParenthesis", input.slice(s, e)]);
<add> return e;
<add> },
<add> rightParenthesis: (input, s, e) => {
<add> results.push(["rightParenthesis", input.slice(s, e)]);
<add> return e;
<add> },
<add> semicolon: (input, s, e) => {
<add> results.push(["semicolon", input.slice(s, e)]);
<add> return e;
<add> },
<add> comma: (input, s, e) => {
<add> results.push(["comma", input.slice(s, e)]);
<add> return e;
<add> },
<add> pseudoClass: (input, s, e) => {
<add> results.push(["pseudoClass", input.slice(s, e)]);
<add> return e;
<add> },
<add> pseudoFunction: (input, s, e) => {
<add> results.push(["pseudoFunction", input.slice(s, e)]);
<add> return e;
<add> },
<add> class: (input, s, e) => {
<add> results.push(["class", input.slice(s, e)]);
<add> return e;
<add> },
<add> identifier: (input, s, e) => {
<add> results.push(["identifier", input.slice(s, e)]);
<add> return e;
<add> },
<add> id: (input, s, e) => {
<add> results.push(["id", input.slice(s, e)]);
<add> return e;
<add> }
<add> });
<add> fn(expect(results));
<add> });
<add> };
<add> test(
<add> "parse urls",
<add> `body {
<add> background: url(
<add> https://example\\2f4a8f.com\
<add>/image.png
<add> )
<add>}
<add>--element\\ name.class\\ name#_id {
<add> background: url( "https://example.com/some url \\"with\\" 'spaces'.png" ) url('https://example.com/\\'"quotes"\\'.png');
<add>}`,
<add> e =>
<add> e.toMatchInlineSnapshot(`
<add>Array [
<add> Array [
<add> "identifier",
<add> "body",
<add> ],
<add> Array [
<add> "leftCurlyBracket",
<add> "{",
<add> ],
<add> Array [
<add> "identifier",
<add> "background",
<add> ],
<add> Array [
<add> "url",
<add> "url(
<add> https://example\\\\2f4a8f.com/image.png
<add> )",
<add> "https://example\\\\2f4a8f.com/image.png",
<add> ],
<add> Array [
<add> "rightCurlyBracket",
<add> "}",
<add> ],
<add> Array [
<add> "identifier",
<add> "--element\\\\ name",
<add> ],
<add> Array [
<add> "class",
<add> ".class\\\\ name",
<add> ],
<add> Array [
<add> "id",
<add> "#_id",
<add> ],
<add> Array [
<add> "leftCurlyBracket",
<add> "{",
<add> ],
<add> Array [
<add> "identifier",
<add> "background",
<add> ],
<add> Array [
<add> "url",
<add> "url( \\"https://example.com/some url \\\\\\"with\\\\\\" 'spaces'.png\\" )",
<add> "https://example.com/some url \\\\\\"with\\\\\\" 'spaces'.png",
<add> ],
<add> Array [
<add> "url",
<add> "url('https://example.com/\\\\'\\"quotes\\"\\\\'.png')",
<add> "https://example.com/\\\\'\\"quotes\\"\\\\'.png",
<add> ],
<add> Array [
<add> "semicolon",
<add> ";",
<add> ],
<add> Array [
<add> "rightCurlyBracket",
<add> "}",
<add> ],
<add>]
<add>`)
<add> );
<add>
<add> test(
<add> "parse pseudo functions",
<add> `:local(.class#id, .class:not(*:hover)) { color: red; }
<add>:import(something from ":somewhere") {}`,
<add> e =>
<add> e.toMatchInlineSnapshot(`
<add>Array [
<add> Array [
<add> "pseudoFunction",
<add> ":local(",
<add> ],
<add> Array [
<add> "class",
<add> ".class",
<add> ],
<add> Array [
<add> "id",
<add> "#id",
<add> ],
<add> Array [
<add> "comma",
<add> ",",
<add> ],
<add> Array [
<add> "class",
<add> ".class",
<add> ],
<add> Array [
<add> "pseudoFunction",
<add> ":not(",
<add> ],
<add> Array [
<add> "pseudoClass",
<add> ":hover",
<add> ],
<add> Array [
<add> "rightParenthesis",
<add> ")",
<add> ],
<add> Array [
<add> "rightParenthesis",
<add> ")",
<add> ],
<add> Array [
<add> "leftCurlyBracket",
<add> "{",
<add> ],
<add> Array [
<add> "identifier",
<add> "color",
<add> ],
<add> Array [
<add> "identifier",
<add> "red",
<add> ],
<add> Array [
<add> "semicolon",
<add> ";",
<add> ],
<add> Array [
<add> "rightCurlyBracket",
<add> "}",
<add> ],
<add> Array [
<add> "pseudoFunction",
<add> ":import(",
<add> ],
<add> Array [
<add> "identifier",
<add> "something",
<add> ],
<add> Array [
<add> "identifier",
<add> "from",
<add> ],
<add> Array [
<add> "rightParenthesis",
<add> ")",
<add> ],
<add> Array [
<add> "leftCurlyBracket",
<add> "{",
<add> ],
<add> Array [
<add> "rightCurlyBracket",
<add> "}",
<add> ],
<add>]
<add>`)
<add> );
<add>}); | 2 |
Go | Go | migrate some config secret tests to api test | 99e28188507bbcb925b0c09df6b53cdd882d24c5 | <ide><path>integration-cli/docker_cli_secret_create_test.go
<ide> import (
<ide> "github.com/go-check/check"
<ide> )
<ide>
<del>func (s *DockerSwarmSuite) TestSecretCreate(c *check.C) {
<del> d := s.AddDaemon(c, true, true)
<del>
<del> testName := "test_secret"
<del> id := d.CreateSecret(c, swarm.SecretSpec{
<del> Annotations: swarm.Annotations{
<del> Name: testName,
<del> },
<del> Data: []byte("TESTINGDATA"),
<del> })
<del> c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
<del>
<del> secret := d.GetSecret(c, id)
<del> c.Assert(secret.Spec.Name, checker.Equals, testName)
<del>}
<del>
<del>func (s *DockerSwarmSuite) TestSecretCreateWithLabels(c *check.C) {
<del> d := s.AddDaemon(c, true, true)
<del>
<del> testName := "test_secret"
<del> id := d.CreateSecret(c, swarm.SecretSpec{
<del> Annotations: swarm.Annotations{
<del> Name: testName,
<del> Labels: map[string]string{
<del> "key1": "value1",
<del> "key2": "value2",
<del> },
<del> },
<del> Data: []byte("TESTINGDATA"),
<del> })
<del> c.Assert(id, checker.Not(checker.Equals), "", check.Commentf("secrets: %s", id))
<del>
<del> secret := d.GetSecret(c, id)
<del> c.Assert(secret.Spec.Name, checker.Equals, testName)
<del> c.Assert(len(secret.Spec.Labels), checker.Equals, 2)
<del> c.Assert(secret.Spec.Labels["key1"], checker.Equals, "value1")
<del> c.Assert(secret.Spec.Labels["key2"], checker.Equals, "value2")
<del>}
<del>
<ide> // Test case for 28884
<ide> func (s *DockerSwarmSuite) TestSecretCreateResolve(c *check.C) {
<ide> d := s.AddDaemon(c, true, true)
<ide><path>integration/secret/secret_test.go
<ide> func createSecret(ctx context.Context, t *testing.T, client client.APIClient, na
<ide> return secret.ID
<ide> }
<ide>
<del>func TestSecretsCreate(t *testing.T) {
<add>func TestSecretsCreateAndDelete(t *testing.T) {
<ide> skip.If(t, testEnv.DaemonInfo.OSType != "linux")
<ide>
<ide> defer setupTest(t)()
<ide> func TestSecretsCreate(t *testing.T) {
<ide> ctx := context.Background()
<ide>
<ide> testName := "test_secret"
<del> createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
<del> require.NoError(t, err)
<add> secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
<ide>
<ide> // create an already existin secret, daemon should return a status code of 409
<ide> _, err = client.SecretCreate(ctx, swarmtypes.SecretSpec{
<ide> func TestSecretsCreate(t *testing.T) {
<ide> Data: []byte("TESTINGDATA"),
<ide> })
<ide> testutil.ErrorContains(t, err, "already exists")
<del>}
<del>
<del>func TestSecretsDelete(t *testing.T) {
<del> skip.If(t, testEnv.DaemonInfo.OSType != "linux")
<del>
<del> defer setupTest(t)()
<del> d := swarm.NewSwarm(t, testEnv)
<del> defer d.Stop(t)
<del> client, err := client.NewClientWithOpts(client.WithHost((d.Sock())))
<del> require.NoError(t, err)
<del>
<del> ctx := context.Background()
<del>
<del> testName := "test_secret"
<del> secretID := createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), nil)
<del> require.NoError(t, err)
<del>
<del> insp, _, err := client.SecretInspectWithRaw(ctx, secretID)
<del> require.NoError(t, err)
<del> assert.Equal(t, insp.ID, secretID)
<ide>
<add> // Ported from original TestSecretsDelete
<ide> err = client.SecretRemove(ctx, secretID)
<ide> require.NoError(t, err)
<ide>
<ide> func TestSecretsDelete(t *testing.T) {
<ide>
<ide> err = client.SecretRemove(ctx, "non-existin")
<ide> testutil.ErrorContains(t, err, "No such secret: non-existin")
<add>
<add> // Ported from original TestSecretsCreteaWithLabels
<add> testName = "test_secret_with_labels"
<add> secretID = createSecret(ctx, t, client, testName, []byte("TESTINGDATA"), map[string]string{
<add> "key1": "value1",
<add> "key2": "value2",
<add> })
<add>
<add> insp, _, err := client.SecretInspectWithRaw(ctx, secretID)
<add> require.NoError(t, err)
<add> assert.Equal(t, insp.Spec.Name, testName)
<add> assert.Equal(t, len(insp.Spec.Labels), 2)
<add> assert.Equal(t, insp.Spec.Labels["key1"], "value1")
<add> assert.Equal(t, insp.Spec.Labels["key2"], "value2")
<ide> }
<ide>
<ide> func TestSecretsUpdate(t *testing.T) { | 2 |
Javascript | Javascript | remove unused vars from specs | d7d6d0838f2066ec51dd41559e4b6eeba1adca77 | <ide><path>spec/application-delegate-spec.js
<ide> /** @babel */
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it } from './async-spec-helpers'
<ide> import ApplicationDelegate from '../src/application-delegate'
<ide>
<ide> describe('ApplicationDelegate', function () {
<ide><path>spec/atom-environment-spec.js
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<ide> beforeEach,
<ide> afterEach,
<ide> conditionPromise
<ide> } = require('./async-spec-helpers')
<del>const _ = require('underscore-plus')
<ide> const fs = require('fs')
<ide> const path = require('path')
<ide> const temp = require('temp').track()
<ide> describe('AtomEnvironment', () => {
<ide>
<ide> it('will open the dev tools when an error is triggered', async () => {
<ide> try {
<del> a + 1
<add> a + 1 // eslint-ignore-line no-unused-vars
<ide> } catch (e) {
<ide> window.onerror.call(window, e.toString(), 'abc', 2, 3, e)
<ide> }
<ide> describe('AtomEnvironment', () => {
<ide> describe('adding a project folder', () => {
<ide> it('does nothing if the user dismisses the file picker', () => {
<ide> const initialPaths = atom.project.getPaths()
<del> const tempDirectory = temp.mkdirSync('a-new-directory')
<ide> spyOn(atom, 'pickFolder').andCallFake(callback => callback(null))
<ide> atom.addProjectFolder()
<ide> expect(atom.project.getPaths()).toEqual(initialPaths)
<ide> describe('AtomEnvironment', () => {
<ide> })
<ide>
<ide> it('adds the selected folder to the project', async () => {
<del> const initialPaths = atom.project.setPaths([])
<add> atom.project.setPaths([])
<ide> const tempDirectory = temp.mkdirSync('a-new-directory')
<ide> spyOn(atom, 'pickFolder').andCallFake(callback =>
<ide> callback([tempDirectory])
<ide> describe('AtomEnvironment', () => {
<ide>
<ide> describe('::destroy()', () => {
<ide> it('does not throw exceptions when unsubscribing from ipc events (regression)', async () => {
<del> const configDirPath = temp.mkdirSync('atom-spec-environment')
<ide> const fakeDocument = {
<ide> addEventListener () {},
<ide> removeEventListener () {},
<ide><path>spec/atom-paths-spec.js
<ide> /** @babel */
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it, beforeEach, afterEach } from './async-spec-helpers'
<ide> import { app } from 'remote'
<ide> import atomPaths from '../src/atom-paths'
<ide> import fs from 'fs-plus'
<ide><path>spec/command-installer-spec.js
<ide> const fs = require('fs-plus')
<ide> const temp = require('temp').track()
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<ide> beforeEach,
<ide> afterEach
<ide> } = require('./async-spec-helpers')
<ide><path>spec/command-registry-spec.js
<ide> const CommandRegistry = require('../src/command-registry')
<ide> const _ = require('underscore-plus')
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> describe('CommandRegistry', () => {
<ide> let registry, parent, child, grandchild
<ide><path>spec/config-file-spec.js
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<add>
<ide> beforeEach,
<del> afterEach,
<del> conditionPromise
<add> afterEach
<ide> } = require('./async-spec-helpers')
<ide> const fs = require('fs-plus')
<ide> const path = require('path')
<ide><path>spec/dock-spec.js
<ide>
<ide> const Grim = require('grim')
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it } from './async-spec-helpers'
<ide> import etch from 'etch'
<ide>
<ide> const getNextUpdatePromise = () => etch.getScheduler().nextUpdatePromise
<ide> describe('Dock', () => {
<ide> },
<ide> serialize: () => ({ deserializer: 'DockTestItem' })
<ide> }
<del> const itemDeserializer = atom.deserializers.add({
<add> atom.deserializers.add({
<ide> name: 'DockTestItem',
<ide> deserialize: () => item
<ide> })
<ide><path>spec/git-repository-provider-spec.js
<ide> const temp = require('temp').track()
<ide> const { Directory } = require('pathwatcher')
<ide> const GitRepository = require('../src/git-repository')
<ide> const GitRepositoryProvider = require('../src/git-repository-provider')
<del>const { it, fit, ffit, fffit, beforeEach } = require('./async-spec-helpers')
<add>const { it, beforeEach } = require('./async-spec-helpers')
<ide>
<ide> describe('GitRepositoryProvider', () => {
<ide> let provider
<ide><path>spec/git-repository-spec.js
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide> const path = require('path')
<ide> const fs = require('fs-plus')
<ide> const temp = require('temp').track()
<ide> describe('GitRepository', () => {
<ide> await project2.deserialize(atom.project.serialize({ isUnloading: false }))
<ide>
<ide> buffer = project2.getBuffers()[0]
<del>
<del> const originalContent = buffer.getText()
<ide> buffer.append('changes')
<ide>
<ide> statusHandler = jasmine.createSpy('statusHandler')
<ide><path>spec/grammar-registry-spec.js
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> const dedent = require('dedent')
<ide> const path = require('path')
<ide> describe('GrammarRegistry', () => {
<ide> require.resolve('language-javascript/grammars/javascript.cson')
<ide> )
<ide>
<del> const disposable = grammarRegistry.maintainLanguageMode(buffer)
<add> grammarRegistry.maintainLanguageMode(buffer)
<ide> expect(retainedBufferCount(grammarRegistry)).toBe(1)
<ide> expect(subscriptionCount(grammarRegistry)).toBe(3)
<ide>
<ide><path>spec/history-manager-spec.js
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<del>const { Emitter, Disposable, CompositeDisposable } = require('event-kit')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> const { HistoryManager, HistoryProject } = require('../src/history-manager')
<ide> const StateStore = require('../src/state-store')
<ide><path>spec/package-manager-spec.js
<ide> const { Disposable } = require('atom')
<ide> const { buildKeydownEvent } = require('../src/keymap-extensions')
<ide> const { mockLocalStorage } = require('./spec-helper')
<ide> const ModuleCache = require('../src/module-cache')
<del>const { it, fit, ffit, beforeEach, afterEach } = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> describe('PackageManager', () => {
<ide> function createTestElement (className) {
<ide><path>spec/package-transpilation-registry-spec.js
<ide> /** @babel */
<del>import fs from 'fs'
<ide> import path from 'path'
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it, beforeEach } from './async-spec-helpers'
<ide>
<ide> import PackageTranspilationRegistry from '../src/package-transpilation-registry'
<ide>
<ide><path>spec/pane-container-spec.js
<ide> const PaneContainer = require('../src/pane-container')
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<add>
<add> beforeEach
<ide> } = require('./async-spec-helpers')
<ide>
<ide> describe('PaneContainer', () => {
<ide><path>spec/pane-spec.js
<ide> const Pane = require('../src/pane')
<ide> const PaneContainer = require('../src/pane-container')
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<ide> beforeEach,
<ide> conditionPromise,
<ide> timeoutPromise
<ide><path>spec/panel-spec.js
<ide> describe('Panel', () => {
<ide>
<ide> describe('creating an atom-panel via markup', () => {
<ide> it('does not throw an error', () => {
<del> const element = document.createElement('atom-panel')
<add> document.createElement('atom-panel')
<ide> })
<ide> })
<ide> })
<ide><path>spec/reopen-project-menu-manager-spec.js
<ide> /** @babel */
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<del>import { Emitter, Disposable, CompositeDisposable } from 'event-kit'
<add>import { it, beforeEach } from './async-spec-helpers'
<add>import { Disposable } from 'event-kit'
<ide>
<ide> const ReopenProjectMenuManager = require('../src/reopen-project-menu-manager')
<ide>
<ide><path>spec/state-store-spec.js
<ide> /** @babel */
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it } from './async-spec-helpers'
<ide>
<ide> const StateStore = require('../src/state-store.js')
<ide>
<ide><path>spec/style-manager-spec.js
<ide> describe('StyleManager', () => {
<ide>
<ide> describe('when a sourcePath parameter is specified', () => {
<ide> it('ensures a maximum of one style element for the given source path, updating a previous if it exists', () => {
<del> const disposable1 = styleManager.addStyleSheet('a {color: red}', {
<add> styleManager.addStyleSheet('a {color: red}', {
<ide> sourcePath: '/foo/bar'
<ide> })
<ide> expect(addEvents.length).toBe(1)
<ide><path>spec/text-editor-component-spec.js
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<add>
<ide> beforeEach,
<ide> afterEach,
<del> conditionPromise,
<del> timeoutPromise
<add> conditionPromise
<ide> } = require('./async-spec-helpers')
<ide>
<ide> const Random = require('../script/node_modules/random-seed')
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('re-renders lines when their height changes', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> rowsPerTile: 3,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('makes the content at least as tall as the scroll container client height', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> text: 'a'.repeat(100),
<ide> width: 50,
<ide> height: 100
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('honors the scrollPastEnd option by adding empty space equivalent to the clientHeight to the end of the content area', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> autoHeight: false,
<ide> autoWidth: false
<ide> })
<del> const { scrollContainer } = component.refs
<ide>
<ide> await editor.update({ scrollPastEnd: true })
<ide> await setEditorHeightInLines(component, 6)
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('gives the line number tiles an explicit width and height so their layout can be strictly contained', async () => {
<del> const { component, element, editor } = buildComponent({ rowsPerTile: 3 })
<add> const { component, editor } = buildComponent({ rowsPerTile: 3 })
<ide>
<ide> const lineNumberGutterElement =
<ide> component.refs.gutterContainer.refs.lineNumberGutter.element
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('keeps the number of tiles stable when the visible line count changes during vertical scrolling', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> rowsPerTile: 3,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('recycles tiles on resize', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it("updates lines numbers when a row's foldability changes (regression)", async () => {
<del> const { component, element, editor } = buildComponent({ text: 'abc\n' })
<add> const { component, editor } = buildComponent({ text: 'abc\n' })
<ide> editor.setCursorBufferPosition([1, 0])
<ide> await component.getNextUpdatePromise()
<ide> expect(
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('shows the foldable icon on the last screen row of a buffer row that can be folded', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> text: 'abc\n de\nfghijklm\n no',
<ide> softWrapped: true
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('renders dummy vertical and horizontal scrollbars when content overflows', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> height: 100,
<ide> width: 100
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('places the hidden input element at the location of the last cursor if it is visible', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> height: 60,
<ide> width: 120,
<ide> rowsPerTile: 2
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('decorates the line numbers of folded lines', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> editor.foldBufferRow(1)
<ide> await component.getNextUpdatePromise()
<ide> expect(
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('makes lines at least as wide as the scrollContainer', async () => {
<ide> const { component, element, editor } = buildComponent()
<del> const { scrollContainer, gutterContainer } = component.refs
<add> const { scrollContainer } = component.refs
<ide> editor.setText('a')
<ide> await component.getNextUpdatePromise()
<ide>
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide> const editorPadding = 3
<ide> element.style.padding = editorPadding + 'px'
<del> const { gutterContainer, scrollContainer } = component.refs
<ide> const initialWidth = element.offsetWidth
<ide> const initialHeight = element.offsetHeight
<ide> expect(initialWidth).toBe(
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not render the line number gutter at all if the isLineNumberGutterVisible parameter is false', () => {
<del> const { component, element, editor } = buildComponent({
<add> const { element } = buildComponent({
<ide> lineNumberGutterVisible: false
<ide> })
<ide> expect(element.querySelector('.line-number')).toBe(null)
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('does not blow away class names added to the element by packages when changing the class name', async () => {
<ide> assertDocumentFocused()
<del> const { component, element, editor } = buildComponent()
<add> const { component, element } = buildComponent()
<ide> element.classList.add('a', 'b')
<ide> expect(element.className).toBe('editor a b')
<ide> element.focus()
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('does not blow away class names managed by the component when packages change the element class name', async () => {
<ide> assertDocumentFocused()
<del> const { component, element, editor } = buildComponent({ mini: true })
<add> const { component, element } = buildComponent({ mini: true })
<ide> element.classList.add('a', 'b')
<ide> element.focus()
<ide> await component.getNextUpdatePromise()
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('ignores resize events when the editor is hidden', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> autoHeight: false
<ide> })
<ide> element.style.height = 5 * component.getLineHeight() + 'px'
<ide> describe('TextEditorComponent', () => {
<ide> describe('mini editors', () => {
<ide> it('adds the mini attribute and class even when the element is not attached', () => {
<ide> {
<del> const { element, editor } = buildComponent({ mini: true })
<add> const { element } = buildComponent({ mini: true })
<ide> expect(element.hasAttribute('mini')).toBe(true)
<ide> expect(element.classList.contains('mini')).toBe(true)
<ide> }
<ide>
<ide> {
<del> const { element, editor } = buildComponent({
<add> const { element } = buildComponent({
<ide> mini: true,
<ide> attach: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not render the gutter container', () => {
<del> const { component, element, editor } = buildComponent({ mini: true })
<add> const { component, element } = buildComponent({ mini: true })
<ide> expect(component.refs.gutterContainer).toBeUndefined()
<ide> expect(element.querySelector('gutter-container')).toBeNull()
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not render scrollbars', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> mini: true,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('focuses the hidden input element and adds the is-focused class when focused', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, element } = buildComponent()
<ide> const { hiddenInput } = component.refs.cursorsAndInput.refs
<ide>
<ide> expect(document.activeElement).not.toBe(hiddenInput)
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('updates the component when the hidden input is focused directly', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, element } = buildComponent()
<ide> const { hiddenInput } = component.refs.cursorsAndInput.refs
<ide> expect(element.classList.contains('is-focused')).toBe(false)
<ide> expect(document.activeElement).not.toBe(hiddenInput)
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('gracefully handles a focus event that occurs prior to the attachedCallback of the element', () => {
<del> const { component, element, editor } = buildComponent({ attach: false })
<add> const { component, element } = buildComponent({ attach: false })
<ide> const parent = document.createElement(
<ide> 'text-editor-component-test-element'
<ide> )
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('gracefully handles a focus event that occurs prior to detecting the element has become visible', async () => {
<del> const { component, element, editor } = buildComponent({ attach: false })
<add> const { component, element } = buildComponent({ attach: false })
<ide> element.style.display = 'none'
<ide> jasmine.attachToDOM(element)
<ide> element.style.display = 'block'
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('automatically scrolls horizontally when the requested range is within the horizontal scroll margin of the right edge of the gutter or right edge of the scroll container', async () => {
<ide> const { component, element, editor } = buildComponent()
<del> const { scrollContainer } = component.refs
<ide> element.style.width =
<ide> component.getGutterContainerWidth() +
<ide> 3 *
<ide> describe('TextEditorComponent', () => {
<ide> const { component, element, editor } = buildComponent({
<ide> autoHeight: false
<ide> })
<del> const { scrollContainer } = component.refs
<ide> element.style.height = component.getContentHeight() / 2 + 'px'
<ide> element.style.width = component.getScrollWidth() + 'px'
<ide> await component.getNextUpdatePromise()
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('logical scroll positions', () => {
<ide> it('allows the scrollTop to be changed and queried in terms of rows via setScrollTopRow and getScrollTopRow', () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> attach: false,
<ide> height: 80
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> describe('scrolling via the mouse wheel', () => {
<ide> it('scrolls vertically or horizontally depending on whether deltaX or deltaY is larger', () => {
<ide> const scrollSensitivity = 30
<del> const { component, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> height: 50,
<ide> width: 50,
<ide> scrollSensitivity
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('inverts deltaX and deltaY when holding shift on Windows and Linux', async () => {
<ide> const scrollSensitivity = 50
<del> const { component, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> height: 50,
<ide> width: 50,
<ide> scrollSensitivity
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('scrolling via the API', () => {
<ide> it('ignores scroll requests to NaN, null or undefined positions', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('line and line number decorations', () => {
<ide> it('adds decoration classes on screen lines spanned by decorated markers', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> softWrapped: true
<ide> })
<ide> await setEditorWidthInCharacters(component, 55)
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> const marker1 = editor.markScreenRange([[1, 10], [3, 10]])
<ide> const layer = editor.addMarkerLayer()
<del> const marker2 = layer.markScreenPosition([5, 0])
<del> const marker3 = layer.markScreenPosition([8, 0])
<add> layer.markScreenPosition([5, 0])
<add> layer.markScreenPosition([8, 0])
<ide> const marker4 = layer.markScreenPosition([10, 0])
<del> const markerDecoration = editor.decorateMarker(marker1, {
<add> editor.decorateMarker(marker1, {
<ide> type: ['line', 'line-number'],
<ide> class: 'a'
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('honors the onlyEmpty and onlyNonEmpty decoration options', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const marker = editor.markScreenPosition([1, 0])
<ide> editor.decorateMarker(marker, {
<ide> type: ['line', 'line-number'],
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('honors the onlyHead option', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const marker = editor.markScreenRange([[1, 4], [3, 4]])
<ide> editor.decorateMarker(marker, {
<ide> type: ['line', 'line-number'],
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('only decorates the last row of non-empty ranges that end at column 0 if omitEmptyLastRow is false', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const marker = editor.markScreenRange([[1, 0], [3, 0]])
<ide> editor.decorateMarker(marker, {
<ide> type: ['line', 'line-number'],
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not decorate invalidated markers', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const marker = editor.markScreenRange([[1, 0], [3, 0]], {
<ide> invalidate: 'touch'
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> }
<ide>
<ide> it('renders overlay elements at the specified screen position unless it would overflow the window', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> width: 200,
<ide> height: 100,
<ide> attach: false
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not attempt to avoid overflowing the window if `avoidOverflow` is false on the decoration', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> width: 200,
<ide> height: 100,
<ide> attach: false
<ide> describe('TextEditorComponent', () => {
<ide> overlayElement.style.margin = '3px'
<ide> overlayElement.style.backgroundColor = 'red'
<ide> const marker = editor.markScreenPosition([4, 25])
<del> const decoration = editor.decorateMarker(marker, {
<add> editor.decorateMarker(marker, {
<ide> type: 'overlay',
<ide> item: overlayElement,
<ide> avoidOverflow: false
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('custom gutter decorations', () => {
<ide> it('arranges custom gutters based on their priority', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> editor.addGutter({ name: 'e', priority: 2 })
<ide> editor.addGutter({ name: 'a', priority: -2 })
<ide> editor.addGutter({ name: 'd', priority: 1 })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('adjusts the left edge of the scroll container based on changes to the gutter container width', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const { scrollContainer, gutterContainer } = component.refs
<ide>
<ide> function checkScrollContainerLeft () {
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('can show and hide custom gutters', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const gutterA = editor.addGutter({ name: 'a', priority: -1 })
<ide> const gutterB = editor.addGutter({ name: 'b', priority: 1 })
<ide> const gutterAElement = gutterA.getElement()
<ide> describe('TextEditorComponent', () => {
<ide> height: 33,
<ide> position: 'before'
<ide> })
<del> const {
<del> item: item4,
<del> decoration: decoration4
<del> } = createBlockDecorationAtScreenRow(editor, 7, {
<add> const { item: item4 } = createBlockDecorationAtScreenRow(editor, 7, {
<ide> height: 44,
<ide> position: 'before'
<ide> })
<del> const {
<del> item: item5,
<del> decoration: decoration5
<del> } = createBlockDecorationAtScreenRow(editor, 7, {
<add> const { item: item5 } = createBlockDecorationAtScreenRow(editor, 7, {
<ide> height: 50,
<ide> marginBottom: 5,
<ide> position: 'after'
<ide> })
<del> const {
<del> item: item6,
<del> decoration: decoration6
<del> } = createBlockDecorationAtScreenRow(editor, 12, {
<add> const { item: item6 } = createBlockDecorationAtScreenRow(editor, 12, {
<ide> height: 60,
<ide> marginTop: 6,
<ide> position: 'after'
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('correctly positions line numbers when block decorations are located at tile boundaries', async () => {
<del> const { editor, component, element } = buildComponent({ rowsPerTile: 3 })
<add> const { editor, component } = buildComponent({ rowsPerTile: 3 })
<ide> createBlockDecorationAtScreenRow(editor, 0, {
<ide> height: 5,
<ide> position: 'before'
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('removes block decorations whose markers have been destroyed', async () => {
<del> const { editor, component, element } = buildComponent({ rowsPerTile: 3 })
<add> const { editor, component } = buildComponent({ rowsPerTile: 3 })
<ide> const { marker } = createBlockDecorationAtScreenRow(editor, 2, {
<ide> height: 5,
<ide> position: 'before'
<ide> describe('TextEditorComponent', () => {
<ide> 3,
<ide> { height: 44, position: 'before', invalidate: 'touch' }
<ide> )
<del> const { component, element } = buildComponent({ editor, rowsPerTile: 3 })
<add> const { component } = buildComponent({ editor, rowsPerTile: 3 })
<ide>
<ide> // Invalidating the marker removes the block decoration.
<ide> editor.getBuffer().deleteRows(2, 3)
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('does not render block decorations when decorating invalid markers', async () => {
<ide> const editor = buildEditor({ rowsPerTile: 3, autoHeight: false })
<del> const { component, element } = buildComponent({ editor, rowsPerTile: 3 })
<add> const { component } = buildComponent({ editor, rowsPerTile: 3 })
<ide>
<ide> const marker = editor.markScreenPosition([3, 0], { invalidate: 'touch' })
<ide> const item = document.createElement('div')
<ide> item.style.height = 30 + 'px'
<ide> item.style.width = 30 + 'px'
<ide> editor.getBuffer().deleteRows(1, 4)
<ide>
<del> const decoration = editor.decorateMarker(marker, {
<add> editor.decorateMarker(marker, {
<ide> type: 'block',
<ide> item,
<ide> position: 'before'
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> it('does not try to remeasure block decorations whose markers are invalid (regression)', async () => {
<ide> const editor = buildEditor({ rowsPerTile: 3, autoHeight: false })
<del> const { component, element } = buildComponent({ editor, rowsPerTile: 3 })
<del> const { decoration, marker } = createBlockDecorationAtScreenRow(
<del> editor,
<del> 2,
<del> { height: '12px', invalidate: 'touch' }
<del> )
<add> const { component } = buildComponent({ editor, rowsPerTile: 3 })
<add> createBlockDecorationAtScreenRow(editor, 2, {
<add> height: '12px',
<add> invalidate: 'touch'
<add> })
<ide> editor.getBuffer().deleteRows(0, 3)
<ide> await component.getNextUpdatePromise()
<ide>
<ide> describe('TextEditorComponent', () => {
<ide> const marker = editor.markScreenPosition([0, 0])
<ide> const item = document.createElement('div')
<ide> item.textContent = 'block decoration'
<del> const decoration = editor.decorateMarker(marker, {
<add> editor.decorateMarker(marker, {
<ide> type: 'block',
<ide> item
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> const marker = editor.markScreenPosition([0, 0])
<ide> const item = document.createElement('div')
<ide> item.textContent = 'block decoration that could wrap many times'
<del> const decoration = editor.decorateMarker(marker, {
<add> editor.decorateMarker(marker, {
<ide> type: 'block',
<ide> item
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> return lists
<ide> }, [[], []])
<ide>
<del> const [afterItems, afterDecorations] = [undefined, 1, 6, undefined, 6, 2]
<add> const [afterItems] = [undefined, 1, 6, undefined, 6, 2]
<ide> .map(order => {
<ide> return createBlockDecorationAtScreenRow(editor, 2, {
<ide> height: 10,
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not create empty text nodes when a text decoration ends right after a text tag', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const marker = editor.markBufferRange([[0, 8], [0, 29]])
<ide> editor.decorateMarker(marker, { type: 'text', class: 'a' })
<ide> await component.getNextUpdatePromise()
<ide> describe('TextEditorComponent', () => {
<ide> describe('when there is only one cursor', () => {
<ide> it('positions the cursor on single-click or when middle-clicking', async () => {
<ide> for (const button of [0, 1]) {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> const { lineHeight } = component.measurements
<ide>
<ide> editor.setCursorScreenPosition([Infinity, Infinity], {
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('expands the last selection on shift-click', () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide>
<ide> editor.setCursorScreenPosition([2, 18], { autoscroll: false })
<ide> component.didMouseDownOnContent(
<ide> describe('TextEditorComponent', () => {
<ide> )
<ide>
<ide> const {
<del> didDrag,
<del> didStopDragging
<add> didDrag
<ide> } = component.handleMouseDragUntilMouseUp.argsForCall[1][0]
<ide> didDrag(clientPositionForCharacter(component, 0, 8))
<ide> expect(editor.getSelectedScreenRange()).toEqual([[0, 4], [1, 5]])
<ide> describe('TextEditorComponent', () => {
<ide> )
<ide>
<ide> const {
<del> didDrag,
<del> didStopDragging
<add> didDrag
<ide> } = component.handleMouseDragUntilMouseUp.argsForCall[2][0]
<ide> didDrag(clientPositionForCharacter(component, 1, 8))
<ide> expect(editor.getSelectedScreenRange()).toEqual([[1, 0], [3, 0]])
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('autoscrolls the content when dragging near the edge of the scroll container', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> width: 200,
<ide> height: 200
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> clientY: 100
<ide> })
<ide> const {
<del> didDrag,
<del> didStopDragging
<add> didDrag
<ide> } = component.handleMouseDragUntilMouseUp.argsForCall[0][0]
<ide>
<ide> didDrag({ clientX: 199, clientY: 199 })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('autoscrolls when dragging near the top or bottom of the gutter', async () => {
<del> const { component, editor } = buildComponent({
<add> const { component } = buildComponent({
<ide> width: 200,
<ide> height: 200
<ide> })
<del> const { scrollContainer } = component.refs
<ide> spyOn(component, 'handleMouseDragUntilMouseUp')
<ide>
<ide> let previousScrollTop = 0
<ide> describe('TextEditorComponent', () => {
<ide> clientY: 100
<ide> })
<ide> const {
<del> didDrag,
<del> didStopDragging
<add> didDrag
<ide> } = component.handleMouseDragUntilMouseUp.argsForCall[0][0]
<ide> didDrag({ clientX: 199, clientY: 199 })
<ide> assertScrolledDown()
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('on the scrollbars', () => {
<ide> it('delegates the mousedown events to the parent component unless the mousedown was on the actual scrollbar', async () => {
<del> const { component, element, editor } = buildComponent({ height: 100 })
<add> const { component, editor } = buildComponent({ height: 100 })
<ide> await setEditorWidthInCharacters(component, 6)
<ide>
<ide> const verticalScrollbar = component.refs.verticalScrollbar
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('keyboard input', () => {
<ide> it('handles inserted accented characters via the press-and-hold menu on macOS correctly', () => {
<del> const { editor, component, element } = buildComponent({
<add> const { editor, component } = buildComponent({
<ide> text: '',
<ide> chromeVersion: 57
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('maintains the scrollTopRow and scrollLeftColumn when the font size changes', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> rowsPerTile: 1,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('gracefully handles the editor being hidden after a styling change', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> autoHeight: false
<ide> })
<ide> element.style.fontSize =
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not throw an exception on attachment when setting the soft-wrap column', () => {
<del> const { component, element, editor } = buildComponent({
<add> const { element, editor } = buildComponent({
<ide> width: 435,
<ide> attach: false,
<ide> updatedSynchronously: true
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('pixelPositionForScreenPosition(point)', () => {
<ide> it('returns the pixel position for the given point, regardless of whether or not it is currently on screen', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not get the component into an inconsistent state when the model has unflushed changes (regression)', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false,
<ide> text: ''
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('does not shift cursors downward or render off-screen content when measuring off-screen lines (regression)', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, element } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false
<ide> })
<ide> await setEditorHeightInLines(component, 3)
<del> const { top, left } = component.pixelPositionForScreenPosition({
<add> component.pixelPositionForScreenPosition({
<ide> row: 12,
<ide> column: 1
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('screenPositionForPixelPosition', () => {
<ide> it('returns the screen position for the given pixel position, regardless of whether or not it is currently on screen', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> rowsPerTile: 2,
<ide> autoHeight: false
<ide> })
<ide> describe('TextEditorComponent', () => {
<ide>
<ide> describe('model methods that delegate to the component / element', () => {
<ide> it('delegates setHeight and getHeight to the component', async () => {
<del> const { component, element, editor } = buildComponent({
<add> const { component, editor } = buildComponent({
<ide> autoHeight: false
<ide> })
<ide> spyOn(Grim, 'deprecate')
<ide> describe('TextEditorComponent', () => {
<ide> })
<ide>
<ide> it('delegates setWidth and getWidth to the component', async () => {
<del> const { component, element, editor } = buildComponent()
<add> const { component, editor } = buildComponent()
<ide> spyOn(Grim, 'deprecate')
<ide> expect(editor.getWidth()).toBe(component.getScrollContainerWidth())
<ide> expect(Grim.deprecate.callCount).toBe(1)
<ide> function getElementHeight (element) {
<ide> return height
<ide> }
<ide>
<del>function getNextTickPromise () {
<del> return new Promise(resolve => process.nextTick(resolve))
<del>}
<del>
<ide> function queryOnScreenLineNumberElements (element) {
<ide> return Array.from(element.querySelectorAll('.line-number:not(.dummy)'))
<ide> }
<ide><path>spec/text-editor-element-spec.js
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach,
<del> conditionPromise,
<del> timeoutPromise
<add>
<add> beforeEach
<ide> } = require('./async-spec-helpers')
<ide> const TextEditor = require('../src/text-editor')
<ide> const TextEditorElement = require('../src/text-editor-element')
<ide><path>spec/text-editor-registry-spec.js
<ide> const TextEditorRegistry = require('../src/text-editor-registry')
<ide> const TextEditor = require('../src/text-editor')
<ide> const TextBuffer = require('text-buffer')
<ide> const { Point, Range } = TextBuffer
<del>const { it, fit, ffit, fffit } = require('./async-spec-helpers')
<add>const { it } = require('./async-spec-helpers')
<ide> const dedent = require('dedent')
<ide>
<ide> describe('TextEditorRegistry', function () {
<ide> describe('TextEditorRegistry', function () {
<ide> atom.grammars.assignLanguageMode(editor, 'source.js')
<ide> atom.config.set('editor.tabType', 'auto')
<ide> await initialPackageActivation
<del> const languageMode = editor.getBuffer().getLanguageMode()
<ide>
<ide> editor.setText(dedent`
<ide> {
<ide><path>spec/text-editor-spec.js
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<add>
<ide> beforeEach,
<del> afterEach,
<del> conditionPromise,
<del> timeoutPromise
<add> afterEach
<ide> } = require('./async-spec-helpers')
<ide>
<ide> const fs = require('fs')
<ide> describe('TextEditor', () => {
<ide> it('merges multiple cursors', () => {
<ide> editor.setCursorScreenPosition([0, 0])
<ide> editor.addCursorAtScreenPosition([0, 1])
<del> const [cursor1, cursor2] = editor.getCursors()
<add> const [cursor1] = editor.getCursors()
<ide> editor.setCursorScreenPosition([4, 7])
<ide> expect(editor.getCursors().length).toBe(1)
<ide> expect(editor.getCursors()).toEqual([cursor1])
<ide> describe('TextEditor', () => {
<ide>
<ide> it('merges cursors when they overlap', () => {
<ide> editor.addCursorAtScreenPosition([1, 0])
<del> const [cursor1, cursor2] = editor.getCursors()
<add> const [cursor1] = editor.getCursors()
<ide>
<ide> editor.moveUp()
<ide> expect(editor.getCursors()).toEqual([cursor1])
<ide> describe('TextEditor', () => {
<ide> it('merges cursors when they overlap', () => {
<ide> editor.setCursorScreenPosition([12, 2])
<ide> editor.addCursorAtScreenPosition([11, 2])
<del> const [cursor1, cursor2] = editor.getCursors()
<add> const [cursor1] = editor.getCursors()
<ide>
<ide> editor.moveDown()
<ide> expect(editor.getCursors()).toEqual([cursor1])
<ide> describe('TextEditor', () => {
<ide> editor.setCursorScreenPosition([0, 0])
<ide> editor.addCursorAtScreenPosition([0, 1])
<ide>
<del> const [cursor1, cursor2] = editor.getCursors()
<add> const [cursor1] = editor.getCursors()
<ide> editor.moveLeft()
<ide> expect(editor.getCursors()).toEqual([cursor1])
<ide> expect(cursor1.getBufferPosition()).toEqual([0, 0])
<ide> describe('TextEditor', () => {
<ide> it('merges cursors when they overlap', () => {
<ide> editor.setCursorScreenPosition([12, 2])
<ide> editor.addCursorAtScreenPosition([12, 1])
<del> const [cursor1, cursor2] = editor.getCursors()
<add> const [cursor1] = editor.getCursors()
<ide>
<ide> editor.moveRight()
<ide> expect(editor.getCursors()).toEqual([cursor1])
<ide> describe('TextEditor', () => {
<ide> describe('::getCursorScreenPositions()', () => {
<ide> it('returns the cursor positions in the order they were added', () => {
<ide> editor.foldBufferRow(4)
<del> const cursor1 = editor.addCursorAtBufferPosition([8, 5])
<del> const cursor2 = editor.addCursorAtBufferPosition([3, 5])
<add> editor.addCursorAtBufferPosition([8, 5])
<add> editor.addCursorAtBufferPosition([3, 5])
<add>
<ide> expect(editor.getCursorScreenPositions()).toEqual([
<ide> [0, 0],
<ide> [5, 5],
<ide> describe('TextEditor', () => {
<ide> [[1, 10], [1, 20]],
<ide> [[2, 15], [3, 25]]
<ide> ])
<del> const [selection1, selection2, selection3] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide>
<ide> editor.selectDown()
<ide> expect(editor.getSelections()).toEqual([selection1])
<ide> describe('TextEditor', () => {
<ide> [[[0, 9], [0, 13]], [[1, 10], [1, 20]]],
<ide> { reversed: true }
<ide> )
<del> const [selection1, selection2] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide>
<ide> editor.selectUp()
<ide> expect(editor.getSelections().length).toBe(1)
<ide> describe('TextEditor', () => {
<ide> [[[0, 9], [0, 13]], [[0, 13], [1, 20]]],
<ide> { reversed: true }
<ide> )
<del> const [selection1, selection2] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide>
<ide> editor.selectLeft()
<ide> expect(editor.getSelections()).toEqual([selection1])
<ide> describe('TextEditor', () => {
<ide>
<ide> it('merges selections when they intersect when moving right', () => {
<ide> editor.setSelectedBufferRanges([[[0, 9], [0, 14]], [[0, 14], [1, 20]]])
<del> const [selection1, selection2] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide>
<ide> editor.selectRight()
<ide> expect(editor.getSelections()).toEqual([selection1])
<ide> describe('TextEditor', () => {
<ide> selection = editor.getLastSelection()
<ide> editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[4, 4], [5, 5]]])
<ide>
<del> const [selection1, selection2] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide> expect(selection1).toBe(selection)
<ide> expect(selection1.getBufferRange()).toEqual([[2, 2], [3, 3]])
<ide> })
<ide> describe('TextEditor', () => {
<ide> selection = editor.getLastSelection()
<ide> editor.setSelectedScreenRanges([[[2, 2], [3, 4]], [[4, 4], [5, 5]]])
<ide>
<del> const [selection1, selection2] = editor.getSelections()
<add> const [selection1] = editor.getSelections()
<ide> expect(selection1).toBe(selection)
<ide> expect(selection1.getScreenRange()).toEqual([[2, 2], [3, 4]])
<ide> })
<ide> describe('TextEditor', () => {
<ide> it('deletes as normal', () => {
<ide> editor.foldBufferRow(4)
<ide> editor.setCursorScreenPosition([3, 4])
<del> const cursorPositionBefore = editor.getCursorScreenPosition()
<del>
<ide> editor.delete()
<ide>
<ide> expect(buffer.lineForRow(3)).toBe(
<ide> describe('TextEditor', () => {
<ide> })
<ide>
<ide> describe('.pasteText()', () => {
<del> const copyText = function (text, { startColumn, textEditor } = {}) {
<del> if (startColumn == null) startColumn = 0
<del> if (textEditor == null) textEditor = editor
<del> textEditor.setCursorBufferPosition([0, 0])
<del> textEditor.insertText(text)
<del> const numberOfNewlines = text.match(/\n/g).length
<del> const endColumn = text.match(/[^\n]*$/)[0].length
<del> textEditor
<del> .getLastSelection()
<del> .setBufferRange([[0, startColumn], [numberOfNewlines, endColumn]])
<del> return textEditor.cutSelectedText()
<del> }
<del>
<ide> it('pastes text into the buffer', () => {
<ide> editor.setSelectedBufferRanges([[[0, 4], [0, 13]], [[1, 6], [1, 10]]])
<ide> atom.clipboard.write('first')
<ide> describe('TextEditor', () => {
<ide> editor.delete()
<ide> editor.delete()
<ide>
<del> const selections = editor.getSelections()
<ide> expect(buffer.lineForRow(1)).toBe(' var = function( {')
<ide>
<ide> expect(editor.getSelectedBufferRanges()).toEqual([
<ide> describe('TextEditor', () => {
<ide> editor.addCursorAtScreenPosition([0, 2])
<ide> editor.addCursorAtScreenPosition([1, 2])
<ide>
<del> const [cursor1, cursor2, cursor3] = editor.getCursors()
<add> const [cursor1, , cursor3] = editor.getCursors()
<ide> expect(editor.getCursors().length).toBe(3)
<ide>
<ide> buffer.delete([[0, 0], [0, 2]])
<ide> describe('TextEditor', () => {
<ide>
<ide> it("does not throw errors after the marker's containing layer is destroyed", () => {
<ide> const layer = editor.addMarkerLayer()
<del> const marker = layer.markBufferRange([[2, 4], [6, 8]])
<del> const decoration = editor.decorateMarker(marker, {
<del> type: 'highlight',
<del> class: 'foo'
<del> })
<add> layer.markBufferRange([[2, 4], [6, 8]])
<add>
<ide> layer.destroy()
<ide> editor.decorationsStateForScreenRowRange(0, 5)
<ide> })
<ide><path>spec/text-mate-language-mode-spec.js
<ide> const NullGrammar = require('../src/null-grammar')
<ide> const TextMateLanguageMode = require('../src/text-mate-language-mode')
<ide> const TextBuffer = require('text-buffer')
<del>const { Point, Range } = TextBuffer
<add>const { Point } = TextBuffer
<ide> const _ = require('underscore-plus')
<ide> const dedent = require('dedent')
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> describe('TextMateLanguageMode', () => {
<ide> let languageMode, buffer, config
<ide><path>spec/tree-sitter-language-mode-spec.js
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> const fs = require('fs')
<ide> const path = require('path')
<ide><path>spec/update-process-env-spec.js
<ide> /** @babel */
<ide> /* eslint-env jasmine */
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it, beforeEach, afterEach } from './async-spec-helpers'
<ide> import path from 'path'
<ide> import childProcess from 'child_process'
<ide> import {
<ide> updateProcessEnv,
<ide> shouldGetEnvFromShell
<ide> } from '../src/update-process-env'
<ide> import dedent from 'dedent'
<del>import { EventEmitter } from 'events'
<ide> import mockSpawn from 'mock-spawn'
<ide> const temp = require('temp').track()
<ide>
<ide><path>spec/workspace-center-spec.js
<ide>
<ide> const TextEditor = require('../src/text-editor')
<ide>
<del>import {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} from './async-spec-helpers'
<add>import { it } from './async-spec-helpers'
<ide>
<ide> describe('WorkspaceCenter', () => {
<ide> describe('.observeTextEditors()', () => {
<ide><path>spec/workspace-element-spec.js
<ide> const etch = require('etch')
<ide> const path = require('path')
<ide> const temp = require('temp').track()
<ide> const { Disposable } = require('event-kit')
<del>const {
<del> it,
<del> fit,
<del> ffit,
<del> fffit,
<del> beforeEach,
<del> afterEach
<del>} = require('./async-spec-helpers')
<add>const { it, beforeEach, afterEach } = require('./async-spec-helpers')
<ide>
<ide> const getNextUpdatePromise = () => etch.getScheduler().nextUpdatePromise
<ide>
<ide> describe('WorkspaceElement', () => {
<ide> pane6,
<ide> pane7,
<ide> pane8,
<del> pane9,
<ide> leftDockPane,
<ide> rightDockPane,
<ide> bottomDockPane,
<ide> describe('WorkspaceElement', () => {
<ide> pane6 = pane5.splitRight()
<ide>
<ide> pane8 = pane7.splitRight()
<del> pane9 = pane8.splitRight()
<add> pane8.splitRight()
<ide>
<ide> const leftDock = workspace.getLeftDock()
<ide> const rightDock = workspace.getRightDock()
<ide><path>spec/workspace-spec.js
<ide> const fs = require('fs-plus')
<ide> const AtomEnvironment = require('../src/atom-environment')
<ide> const {
<ide> it,
<del> fit,
<del> ffit,
<del> fffit,
<ide> beforeEach,
<ide> afterEach,
<ide> conditionPromise
<ide> describe('Workspace', () => {
<ide> workspace.observeActiveTextEditor(editor => observed.push(editor))
<ide>
<ide> const editorAddedAfterRegisteringObserver = new TextEditor()
<del> const nonEditorItemAddedAfterRegisteringObserver = document.createElement(
<del> 'div'
<del> )
<ide> pane.activateItem(editorAddedAfterRegisteringObserver)
<ide>
<ide> expect(observed).toEqual([
<ide> describe('Workspace', () => {
<ide> const nonEditorItem1 = document.createElement('div')
<ide> const nonEditorItem2 = document.createElement('div')
<ide> pane.activateItem(nonEditorItem1)
<del> pane.activateItem(nonEditorItem1)
<add> pane.activateItem(nonEditorItem2)
<ide>
<ide> expect(observed).toEqual([])
<ide> }) | 29 |
Javascript | Javascript | replace fixturesdir with fixtures module | 023b95bf4abe5f37319ead5c5319bf531c3f4dbb | <ide><path>test/parallel/test-https-client-resume.js
<ide> if (!common.hasCrypto)
<ide> const assert = require('assert');
<ide> const https = require('https');
<ide> const tls = require('tls');
<del>const fs = require('fs');
<add>const fixtures = require('../common/fixtures');
<ide>
<ide> const options = {
<del> key: fs.readFileSync(`${common.fixturesDir}/keys/agent2-key.pem`),
<del> cert: fs.readFileSync(`${common.fixturesDir}/keys/agent2-cert.pem`)
<add> key: fixtures.readKey('agent2-key.pem'),
<add> cert: fixtures.readKey('agent2-cert.pem')
<ide> };
<ide>
<ide> // create server | 1 |
Ruby | Ruby | improve styling of generic help text | 4f8e3cae5e05c05b3681b3afd2f7ac480c522eb1 | <ide><path>Library/Homebrew/cmd/help.rb
<ide> HOMEBREW_HELP = <<-EOS
<ide> Example usage:
<del> brew [info | home | options ] [FORMULA...]
<add> brew (info|home|options) [FORMULA...]
<ide> brew install FORMULA...
<ide> brew uninstall FORMULA...
<del> brew search [foo]
<add> brew search [TEXT|/PATTERN/]
<ide> brew list [FORMULA...]
<ide> brew update
<ide> brew upgrade [FORMULA...]
<del> brew pin/unpin [FORMULA...]
<add> brew (pin|unpin) [FORMULA...]
<ide>
<ide> Troubleshooting:
<ide> brew doctor
<ide> brew install -vd FORMULA
<del> brew [--env | config]
<add> brew (--env|config)
<ide>
<ide> Brewing:
<ide> brew create [URL [--no-fetch]]
<ide>
<ide> Further help:
<ide> man brew
<add> brew help [COMMAND]
<ide> brew home
<ide> EOS
<ide> | 1 |
Java | Java | fix javadoc typos | 9837ec59047b08f0813524208b90fc4fc6e1a1ad | <ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocket.java
<ide> /*
<del> * Copyright 2002-2018 the original author or authors.
<add> * Copyright 2002-2019 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> * registry.addHandler(echoWebSocketHandler(), "/echo").withSockJS();
<ide> * }
<ide> *
<del> * @Bean
<add> * @Override
<ide> * public WebSocketHandler echoWebSocketHandler() {
<ide> * return new EchoWebSocketHandler();
<ide> * }
<ide><path>spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/EnableWebSocketMessageBroker.java
<ide> /*
<del> * Copyright 2002-2016 the original author or authors.
<add> * Copyright 2002-2019 the original author or authors.
<ide> *
<ide> * Licensed under the Apache License, Version 2.0 (the "License");
<ide> * you may not use this file except in compliance with the License.
<ide> * registry.addEndpoint("/portfolio").withSockJS();
<ide> * }
<ide> *
<del> * @Bean
<add> * @Override
<ide> * public void configureMessageBroker(MessageBrokerRegistry registry) {
<ide> * registry.enableStompBrokerRelay("/queue/", "/topic/");
<ide> * registry.setApplicationDestinationPrefixes("/app/"); | 2 |
Ruby | Ruby | give consistent results | 967b9b811238c0750f16a6cea902379e5469f15d | <ide><path>Library/Homebrew/cmd/deps.rb
<ide> def deps
<ide> Formulary.enable_factory_cache!
<ide>
<ide> recursive = !args.send("1?")
<add> installed = args.installed? || ARGV.formulae.all?(&:opt_or_installed_prefix_keg)
<add>
<add> @use_runtime_dependencies = installed && recursive &&
<add> !args.include_build? &&
<add> !args.include_test? &&
<add> !args.include_optional? &&
<add> !args.skip_recommended?
<ide>
<ide> if args.tree?
<ide> if args.installed?
<ide> def deps
<ide> return
<ide> end
<ide>
<del> installed = args.installed? || ARGV.formulae.all?(&:opt_or_installed_prefix_keg)
<del>
<del> @use_runtime_dependencies = installed && recursive &&
<del> !args.include_build? &&
<del> !args.include_test? &&
<del> !args.include_optional? &&
<del> !args.skip_recommended?
<del>
<ide> if Homebrew.args.remaining.empty?
<ide> raise FormulaUnspecifiedError unless args.installed?
<ide>
<ide> def puts_deps_tree(formulae, recursive = false)
<ide>
<ide> def recursive_deps_tree(f, prefix, recursive)
<ide> includes, ignores = argv_includes_ignores(ARGV)
<del> deps = reject_ignores(f.deps, ignores, includes)
<add> dependables = @use_runtime_dependencies ? f.runtime_dependencies : f.deps
<add> deps = reject_ignores(dependables, ignores, includes)
<ide> reqs = reject_ignores(f.requirements, ignores, includes)
<ide> dependables = reqs + deps
<ide> | 1 |
Python | Python | check lack of hole in check_api_dict | 77966f7aa170f0a6eb603f5dae7111429f015262 | <ide><path>numpy/core/code_generators/genapi2.py
<add>import sys
<add>
<add>if sys.version_info[:2] < (2, 6):
<add> from sets import Set as set
<add>
<ide> from genapi import API_FILES, find_functions
<ide>
<ide> def order_dict(d):
<ide> def check_api_dict(d):
<ide> if len(names) != 1]
<ide> raise ValueError(msg)
<ide>
<add> # No 'hole' in the indexes may be allowed, and it must starts at 0
<add> indexes = set(d.values())
<add> expected = set(range(len(indexes)))
<add> if not indexes == expected:
<add> diff = expected.symmetric_difference(indexes)
<add> msg = "There are some holes in the API indexing: " \
<add> "(symmetric diff is %s)" % diff
<add> raise ValueError(msg)
<add>
<ide> def get_api_functions(tagname, api_dict):
<ide> """Parse source files to get functions tagged by the given tag."""
<ide> functions = [] | 1 |
PHP | PHP | add second assertequals | b41c9e1153e8bcb39718bae76d8d8384e59a94ce | <ide><path>tests/Support/SupportCollectionTest.php
<ide> public function testGettingMinItemsFromCollection()
<ide>
<ide> $c = new Collection([['foo' => 10], ['foo' => 20]]);
<ide> $this->assertEquals(10, $c->min('foo'));
<add> $this->assertEquals(10, $c->min->foo);
<ide>
<ide> $c = new Collection([['foo' => 10], ['foo' => 20], ['foo' => null]]);
<ide> $this->assertEquals(10, $c->min('foo'));
<add> $this->assertEquals(10, $c->min->foo);
<ide>
<ide> $c = new Collection([1, 2, 3, 4, 5]);
<ide> $this->assertEquals(1, $c->min()); | 1 |
PHP | PHP | allow isset on view objects | 9a565be05a8fd78641ca80038573f49712454de4 | <ide><path>src/Illuminate/View/View.php
<ide> public function __set($key, $value)
<ide> $this->with($key, $value);
<ide> }
<ide>
<add> /**
<add> * Check if a piece of data is bound to the view.
<add> *
<add> * @param string $key
<add> * @return bool
<add> */
<add> public function __isset($key)
<add> {
<add> return isset($this->data[$key]);
<add> }
<add>
<add> /**
<add> * Remove a piece of bound data from the view.
<add> *
<add> * @param string $key
<add> * @return bool
<add> */
<add> public function __unset($key)
<add> {
<add> unset($this->data[$key]);
<add> }
<add>
<ide> /**
<ide> * Get the string contents of the view.
<ide> * | 1 |
PHP | PHP | remove inline assignment | 9320b197532b28b7322778a87c4be606ef01b02c | <ide><path>lib/Cake/Routing/RouteCollection.php
<ide> protected function _getNames($url) {
<ide> public function parse($url) {
<ide> $out = array();
<ide> for ($i = 0, $len = count($this); $i < $len; $i++) {
<del> if (($r = $this->_routes[$i]->parse($url)) !== false) {
<del> $out = $r;
<del> break;
<add> $r = $this->_routes[$i]->parse($url);
<add> if ($r !== false) {
<add> return $r;
<ide> }
<ide> }
<ide> return $out; | 1 |
Go | Go | pass authentication credentials through to build | 6fed46aeb97943315aed12f2dc62565f7bcc53dc | <ide><path>api/server/router/build/build_routes.go
<ide> func (br *buildRouter) postBuild(ctx context.Context, w http.ResponseWriter, r *
<ide> buildOptions.Dockerfile = dockerfileName
<ide> }
<ide>
<add> buildOptions.AuthConfigs = authConfigs
<add>
<ide> out = output
<ide> if buildOptions.SuppressOutput {
<ide> out = notVerboseBuffer
<ide><path>integration-cli/docker_cli_build_test.go
<ide> func (s *DockerSuite) TestBuildWorkdirWindowsPath(c *check.C) {
<ide> c.Fatal(err)
<ide> }
<ide> }
<add>
<add>func (s *DockerRegistryAuthSuite) TestBuildFromAuthenticatedRegistry(c *check.C) {
<add> dockerCmd(c, "login", "-u", s.reg.username, "-p", s.reg.password, "-e", s.reg.email, privateRegistryURL)
<add>
<add> baseImage := privateRegistryURL + "/baseimage"
<add>
<add> _, err := buildImage(baseImage, `
<add> FROM busybox
<add> ENV env1 val1
<add> `, true)
<add>
<add> c.Assert(err, checker.IsNil)
<add>
<add> dockerCmd(c, "push", baseImage)
<add> dockerCmd(c, "rmi", baseImage)
<add>
<add> _, err = buildImage(baseImage, fmt.Sprintf(`
<add> FROM %s
<add> ENV env2 val2
<add> `, baseImage), true)
<add>
<add> c.Assert(err, checker.IsNil)
<add>} | 2 |
Text | Text | fix extra parens in changelog | 08fd7d4a4827ab1b8f6b5ff377c63bc465e768f4 | <ide><path>CHANGELOG.md
<ide>
<ide> ### Major changes
<ide>
<del>- **Initial render now uses `document.createElement` instead of generating HTML.** Previously we would generate a large string of HTML and then set `node.innerHTML`. At the time, this was decided to be faster than using `document.createElement` for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using `createElement` we can make other parts of React faster. (<small>)[@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
<del>- **`data-reactid` is no longer on every node.** As a result of using `document.createElement`, we can prime the node cache as we create DOM nodes, allowing us to skip a potential lookup (which used the `data-reactid` attribute). Root nodes will have a `data-reactroot` attribute and server generated markup will still contain `data-reactid`. (<small>)[@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
<add>- **Initial render now uses `document.createElement` instead of generating HTML.** Previously we would generate a large string of HTML and then set `node.innerHTML`. At the time, this was decided to be faster than using `document.createElement` for the majority of cases and browsers that we supported. Browsers have continued to improve and so overwhelmingly this is no longer true. By using `createElement` we can make other parts of React faster. (<small>[@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
<add>- **`data-reactid` is no longer on every node.** As a result of using `document.createElement`, we can prime the node cache as we create DOM nodes, allowing us to skip a potential lookup (which used the `data-reactid` attribute). Root nodes will have a `data-reactroot` attribute and server generated markup will still contain `data-reactid`. (<small>[@spicyj](https://github.com/spicyj) in [#5205](https://github.com/facebook/react/pull/5205))
<ide> - **No more extra `<span>`s.** ReactDOM will now render plain text nodes interspersed with comment nodes that are used for demarcation. This gives us the same ability to update individual pieces of text, without creating extra nested nodes. If you were targeting these `<span>`s in your CSS, you will need to adjust accordingly. You can always render them explicitly in your components. ([@mwiencek](https://github.com/mwiencek) in [#5753](https://github.com/facebook/react/pull/5753))
<del>- **Rendering `null` now uses comment nodes.** Previously `null` would render to `<noscript>` elements. We now use comment nodes. This may cause issues if making use of `:nth-child` CSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. ()[@spicyj](https://github.com/spicyj) in [#5451](https://github.com/facebook/react/pull/5451))
<add>- **Rendering `null` now uses comment nodes.** Previously `null` would render to `<noscript>` elements. We now use comment nodes. This may cause issues if making use of `:nth-child` CSS selectors. While we consider this rendering behavior an implementation detail of React, it's worth noting the potential problem. ([@spicyj](https://github.com/spicyj) in [#5451](https://github.com/facebook/react/pull/5451))
<ide> - **Functional components can now return `null`.** We added support for [defining stateless components as functions](/react/blog/2015/09/10/react-v0.14-rc1.html#stateless-function-components) in React 0.14. However, React 0.14 still allowed you to define a class component without extending `React.Component` or using `React.createClass()`, so [we couldn’t reliably tell if your component is a function or a class](https://github.com/facebook/react/issues/5355), and did not allow returning `null` from it. This issue is solved in React 15, and you can now return `null` from any component, whether it is a class or a function. ([@jimfb](https://github.com/jimfb) in [#5884](https://github.com/facebook/react/pull/5884))
<ide> - **Improved SVG support.** All SVG tags are now fully supported. (Uncommon SVG tags are not present on the `React.DOM` element helper, but JSX and `React.createElement` work on all tag names.) All SVG attributes that are implemented by the browsers should be supported too. If you find any attributes that we have missed, please [let us know in this issue](https://github.com/facebook/react/issues/1657). ([@zpao](https://github.com/zpao) in [#6243](https://github.com/facebook/react/pull/6243))
<ide> | 1 |
Ruby | Ruby | wipe those tears.. references [4335] | f9f65433efa18969b81ec1a8ab8d74d01bfd464e | <ide><path>activerecord/test/migration_test.rb
<ide> def test_create_table_with_defaults
<ide> end
<ide>
<ide> def test_create_table_with_limits
<del> Person.connection.create_table :testings do |t|
<del> t.column :foo, :string, :limit => 255
<add> assert_nothing_raised do
<add> Person.connection.create_table :testings do |t|
<add> t.column :foo, :string, :limit => 255
<ide>
<del> t.column :default_int, :integer
<add> t.column :default_int, :integer
<ide>
<del> t.column :one_int, :integer, :limit => 1
<del> t.column :four_int, :integer, :limit => 4
<del> t.column :eight_int, :integer, :limit => 8
<add> t.column :one_int, :integer, :limit => 1
<add> t.column :four_int, :integer, :limit => 4
<add> t.column :eight_int, :integer, :limit => 8
<add> end
<ide> end
<ide>
<ide> columns = Person.connection.columns(:testings)
<ide> def test_create_table_with_limits
<ide> assert_equal 'smallint', one.sql_type
<ide> assert_equal 'integer', four.sql_type
<ide> assert_equal 'bigint', eight.sql_type
<del> elsif current_adapter?(:MysqlAdapter)
<del> assert_equal 'int(11)', default.sql_type
<del> assert_equal 'int(1)', one.sql_type
<del> assert_equal 'int(4)', four.sql_type
<del> assert_equal 'int(8)', eight.sql_type
<del> else
<del> assert_equal 'integer', default.sql_type
<del> assert_equal 'integer(1)', one.sql_type
<del> assert_equal 'integer(4)', four.sql_type
<del> assert_equal 'integer(8)', eight.sql_type
<ide> end
<ide> ensure
<ide> Person.connection.drop_table :testings rescue nil | 1 |
Javascript | Javascript | fix language tests | 1dd10e69ce54cc9aaee81a85435c2c4d5461eb9b | <ide><path>test/lang/ar-ma.js
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'يناير:يناير_فبراير:فبراير_مارس:مارس_أبريل:أبريل_ماي:ماي_يونيو:يونيو_يوليوز:يوليوز_غشت:غشت_شتنبر:شتنبر_أكتوبر:أكتوبر_نونبر:نونبر_دجنبر:دجنبر'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد, فبراير 14 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'احد, 3PM'],
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'يناير يناير_فبراير فبراير_مارس مارس_أبريل أبريل_ماي ماي_يونيو يونيو_يوليوز يوليوز_غشت غشت_شتنبر شتنبر_أكتوبر أكتوبر_نونبر نونبر_دجنبر دجنبر'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'الأحد احد ح_الإتنين اتنين ن_الثلاثاء ثلاثاء ث_الأربعاء اربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ثوان", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "دقيقة", "45 seconds = a minute");
<ide> exports["lang:ar-ma"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 أيام", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "شهر", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "شهر", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "شهر", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "شهر", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 أشهر", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 أشهر", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 أشهر", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "شهر", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 أشهر", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 أشهر", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "سنة", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "سنة", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 سنوات", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "سنة", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 سنوات", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "في ثوان", "prefix");
<ide> test.equal(moment(0).from(30000), "منذ ثوان", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "منذ ثوان", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "في ثوان", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "في 5 أيام", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:ar-ma"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).week(), 1, "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).week(), 1, "Jan 6 2012 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2006, 11, 30]).week(), 1, "Dec 30 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 5]).week(), 1, "Jan 5 2007 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 1, "Dec 29 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 28]).week(), 1, "Dec 28 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 27]).week(), 1, "Dec 27 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 11, 26]).week(), 1, "Dec 26 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> test.equal(moment([2011, 0, 7]).week(), 1, "Jan 7 2011 should be week 1");
<ide> exports["lang:ar-ma"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', "Jan 6 2012 should be week 1");
<ide><path>test/lang/ar.js
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'يناير/ كانون الثاني:يناير/ كانون الثاني_فبراير/ شباط:فبراير/ شباط_مارس/ آذار:مارس/ آذار_أبريل/ نيسان:أبريل/ نيسان_مايو/ أيار:مايو/ أيار_يونيو/ حزيران:يونيو/ حزيران_يوليو/ تموز:يوليو/ تموز_أغسطس/ آب:أغسطس/ آب_سبتمبر/ أيلول:سبتمبر/ أيلول_أكتوبر/ تشرين الأول:أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني:نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول:ديسمبر/ كانون الأول'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month());
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'الأحد، فبراير/ شباط ١٤ ٢٠١٠، ٣:٢٥:٥٠ م'],
<ide> ['ddd, hA', 'أحد، ٣م'],
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '١', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '٢', '2');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '٣', '3');
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'يناير/ كانون الثاني يناير/ كانون الثاني_فبراير/ شباط فبراير/ شباط_مارس/ آذار مارس/ آذار_أبريل/ نيسان أبريل/ نيسان_مايو/ أيار مايو/ أيار_يونيو/ حزيران يونيو/ حزيران_يوليو/ تموز يوليو/ تموز_أغسطس/ آب أغسطس/ آب_سبتمبر/ أيلول سبتمبر/ أيلول_أكتوبر/ تشرين الأول أكتوبر/ تشرين الأول_نوفمبر/ تشرين الثاني نوفمبر/ تشرين الثاني_ديسمبر/ كانون الأول ديسمبر/ كانون الأول'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'الأحد أحد ح_الإثنين إثنين ن_الثلاثاء ثلاثاء ث_الأربعاء أربعاء ر_الخميس خميس خ_الجمعة جمعة ج_السبت سبت س'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ثوان", "44 seconds = a few seconds");
<ide> exports["lang:ar"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "٢٥ أيام", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "شهر", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "شهر", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "شهر", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "شهر", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "٢ أشهر", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "٢ أشهر", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "٣ أشهر", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "شهر", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "٥ أشهر", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "١١ أشهر", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "سنة", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "سنة", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "٢ سنوات", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "سنة", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "٥ سنوات", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "في ثوان", "prefix");
<ide> test.equal(moment(0).from(30000), "منذ ثوان", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "منذ ثوان", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "في ثوان", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "في ٥ أيام", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ar"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).week(), 1, "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).week(), 1, "Jan 6 2012 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2006, 11, 30]).week(), 1, "Dec 30 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 5]).week(), 1, "Jan 5 2007 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 1, "Dec 29 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(10);
<ide>
<ide> test.equal(moment([2002, 11, 28]).week(), 1, "Dec 28 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 27]).week(), 1, "Dec 27 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 11, 26]).week(), 1, "Dec 26 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> test.equal(moment([2011, 0, 7]).week(), 1, "Jan 7 2011 should be week 1");
<ide> exports["lang:ar"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).format('w ww wo'), '١ ٠١ ١', "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).format('w ww wo'), '١ ٠١ ١', "Jan 6 2012 should be week 1");
<ide><path>test/lang/bg.js
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, H:mm:ss', 'неделя, февруари 14-ти 2010, 15:25:50'],
<ide> ['ddd, hA', 'нед, 3PM'],
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-ви', '1-ви');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-ри', '2-ри');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3-ти', '3-ти');
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'януари янр_февруари фев_март мар_април апр_май май_юни юни_юли юли_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'неделя нед нд_понеделник пон пн_вторник вто вт_сряда сря ср_четвъртък чет чт_петък пет пт_събота съб сб'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "няколко секунди", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "минута", "45 seconds = a minute");
<ide> exports["lang:bg"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 дни", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "месец", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "месец", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "месец", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "месец", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 месеца", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 месеца", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 месеца", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "месец", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 месеца", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 месеца", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "година", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "година", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 години", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "година", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 години", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "след няколко секунди", "prefix");
<ide> test.equal(moment(0).from(30000), "преди няколко секунди", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "преди няколко секунди", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "след няколко секунди", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "след 5 дни", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:bg"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:bg"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ви', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ви', "Jan 1 2012 should be week 1");
<ide><path>test/lang/br.js
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = "Genver Gen_C'hwevrer C'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker".split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(17);
<ide> moment.lang('br');
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', "Sul, C'hwevrer 14vet 2010, 3:25:50 pm"],
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> moment.lang('br');
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1añ', '1añ');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2vet', '2vet');
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> moment.lang('br');
<ide> var expected = "Genver Gen_C'hwevrer C'hwe_Meurzh Meu_Ebrel Ebr_Mae Mae_Mezheven Eve_Gouere Gou_Eost Eos_Gwengolo Gwe_Here Her_Du Du_Kerzu Ker".split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> moment.lang('br');
<ide> var expected = "Sul Sul Su_Lun Lun Lu_Meurzh Meu Me_Merc'her Mer Mer_Yaou Yao Ya_Gwener Gwe Gw_Sadorn Sad Sa".split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> moment.lang('br');
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "un nebeud segondennoù", "44 seconds = a few seconds");
<ide> exports["lang:br"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 devezh", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ur miz", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ur miz", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ur miz", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ur miz", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 viz", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 viz", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 miz", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ur miz", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 miz", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 miz", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ur bloaz", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ur bloaz", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 vloaz", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ur bloaz", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 bloaz", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> moment.lang('br');
<ide> test.equal(moment(30000).from(0), "a-benn un nebeud segondennoù", "prefix");
<ide> test.equal(moment(0).from(30000), "un nebeud segondennoù 'zo", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> moment.lang('br');
<ide> test.equal(moment().fromNow(), "un nebeud segondennoù 'zo", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> moment.lang('br');
<ide> test.equal(moment().add({s: 30}).fromNow(), "a-benn un nebeud segondennoù", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "a-benn 5 devezh", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide> moment.lang('br');
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide> moment.lang('br');
<ide>
<ide> var i, m;
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide> moment.lang('br');
<ide>
<ide> var i, m;
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> moment.lang('br');
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:br"] = {
<ide> },
<ide>
<ide> "special mutations for years": function (test) {
<del> test.expect(12);
<ide> moment.lang('br');
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ur bloaz", "mutation 1 year");
<ide><path>test/lang/bs.js
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. februar 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'ned., 3PM'],
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januar jan._februar feb._mart mar._april apr._maj maj._juni jun._juli jul._avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "par sekundi", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "jedna minuta", "45 seconds = a minute");
<ide> exports["lang:bs"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dana", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mjesec", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mjesec", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mjesec", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mjesec", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mjeseca", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mjeseca", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mjeseca", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mjesec", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mjeseci", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mjeseci", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "godinu", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "godinu", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 godine", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "godinu", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 godina", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za par sekundi", "prefix");
<ide> test.equal(moment(0).from(30000), "prije par sekundi", "prefix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "prije par sekundi", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za par sekundi", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "za 5 dana", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:bs"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:bs"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/ca.js
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = "gener gen._febrer febr._març mar._abril abr._maig mai._juny jun._juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre des.".split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = "gener gen._febrer febr._març mar._abril abr._maig mai._juny jun._juliol jul._agost ag._setembre set._octubre oct._novembre nov._desembre des.".split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = "diumenge dg. Dg_dilluns dl. Dl_dimarts dt. Dt_dimecres dc. Dc_dijous dj. Dj_divendres dv. Dv_dissabte ds. Ds".split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "uns segons", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "un minut", "45 seconds = a minute");
<ide> exports["lang:ca"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dies", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mes", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mes", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mes", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mes", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mesos", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mesos", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mesos", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mes", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mesos", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mesos", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un any", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un any", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 anys", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un any", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 anys", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "en uns segons", "prefix");
<ide> test.equal(moment(0).from(30000), "fa uns segons", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "fa uns segons", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "en uns segons", "en uns segons");
<ide> test.equal(moment().add({d: 5}).fromNow(), "en 5 dies", "en 5 dies");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(7);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:ca"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:ca"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', "Jan 2 2012 should be week 1");
<ide><path>test/lang/cs.js
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split("_"), i;
<ide> function equalTest(input, mmm, monthIndex) {
<ide> test.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 1));
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss', 'neděle, únor 14. 2010, 3:25:50'],
<ide> ['ddd, h', 'ne, 3'],
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'leden led_únor úno_březen bře_duben dub_květen kvě_červen čvn_červenec čvc_srpen srp_září zář_říjen říj_listopad lis_prosinec pro'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'neděle ne ne_pondělí po po_úterý út út_středa st st_čtvrtek čt čt_pátek pá pá_sobota so so'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "pár sekund", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "minuta", "45 seconds = a minute");
<ide> exports["lang:cs"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dní", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "měsíc", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "měsíc", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "měsíc", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "měsíc", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 měsíce", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 měsíce", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 měsíce", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "měsíc", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 měsíců", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 měsíců", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "rok", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "rok", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 roky", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "rok", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 let", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za pár sekund", "prefix");
<ide> test.equal(moment(0).from(30000), "před pár sekundami", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "před pár sekundami", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow (future)" : function (test) {
<del> test.expect(16);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za pár sekund", "in a few seconds");
<ide> test.equal(moment().add({m: 1}).fromNow(), "za minutu", "in a minute");
<ide> test.equal(moment().add({m: 3}).fromNow(), "za 3 minuty", "in 3 minutes");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "fromNow (past)" : function (test) {
<del> test.expect(16);
<ide> test.equal(moment().subtract({s: 30}).fromNow(), "před pár sekundami", "a few seconds ago");
<ide> test.equal(moment().subtract({m: 1}).fromNow(), "před minutou", "a minute ago");
<ide> test.equal(moment().subtract({m: 3}).fromNow(), "před 3 minutami", "3 minutes ago");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, nextDay;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, lastDay;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "humanize duration" : function (test) {
<del> test.expect(4);
<ide> test.equal(moment.duration(1, "minutes").humanize(), "minuta", "a minute (future)");
<ide> test.equal(moment.duration(1, "minutes").humanize(true), "za minutu", "in a minute");
<ide> test.equal(moment.duration(-1, "minutes").humanize(), "minuta", "a minute (past)");
<ide> exports["lang:cs"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:cs"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/cv.js
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'кăрлач кăр_нарăс нар_пуш пуш_ака ака_май май_çĕртме çĕр_утă утă_çурла çур_авăн ав_юпа юпа_чӳк чӳк_раштав раш'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'вырсарникун, нарăс 14-мĕш 2010, 3:25:50 pm'],
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-мĕш', '1-мĕш');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-мĕш', '2-мĕш');
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'кăрлач кăр_нарăс нар_пуш пуш_ака ака_май май_çĕртме çĕр_утă утă_çурла çур_авăн ав_юпа юпа_чӳк чӳк_раштав раш'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'вырсарникун выр вр_тунтикун тун тн_ытларикун ытл ыт_юнкун юн юн_кĕçнерникун кĕç кç_эрнекун эрн эр_шăматкун шăм шм'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "пĕр-ик çеккунт", "44 sekunder = a few seconds");
<ide> exports["lang:cv"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 кун", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "пĕр уйăх", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "пĕр уйăх", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "пĕр уйăх", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "пĕр уйăх", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 уйăх", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 уйăх", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 уйăх", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "пĕр уйăх", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 уйăх", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 уйăх", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "пĕр çул", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "пĕр çул", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 çул", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "пĕр çул", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 çул", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "пĕр-ик çеккунтран", "prefix");
<ide> test.equal(moment(0).from(30000), "пĕр-ик çеккунт каялла", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "пĕр-ик çеккунт каялла", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(4);
<ide> test.equal(moment().add({s: 30}).fromNow(), "пĕр-ик çеккунтран", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 кунран", "in 5 days");
<ide> test.equal(moment().add({h: 2}).fromNow(), "2 сехетрен", "in 2 hours, the right suffix!");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide> test.equal(moment(a).calendar(), "Паян 02:00 сехетре", "today at the same time");
<ide> test.equal(moment(a).add({ m: 25 }).calendar(), "Паян 02:25 сехетре", "Now plus 25 min");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:cv"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:cv"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-мĕш', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-мĕш', "Jan 1 2012 should be week 1");
<ide><path>test/lang/cy.js
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.split("_"),
<ide> i;
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Dydd Sul, Chwefror 14eg 2010, 3:25:50 pm'],
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1af', '1af');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2il', '2il');
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'Ionawr Ion_Chwefror Chwe_Mawrth Maw_Ebrill Ebr_Mai Mai_Mehefin Meh_Gorffennaf Gor_Awst Aws_Medi Med_Hydref Hyd_Tachwedd Tach_Rhagfyr Rhag'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Dydd Sul Sul Su_Dydd Llun Llun Ll_Dydd Mawrth Maw Ma_Dydd Mercher Mer Me_Dydd Iau Iau Ia_Dydd Gwener Gwe Gw_Dydd Sadwrn Sad Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ychydig eiliadau", "44 seconds = a few seconds");
<ide> exports["lang:cy"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 diwrnod", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mis", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mis", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mis", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mis", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mis", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mis", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mis", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mis", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mis", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mis", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "blwyddyn", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "blwyddyn", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 flynedd", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "blwyddyn", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 flynedd", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "mewn ychydig eiliadau", "prefix");
<ide> test.equal(moment(0).from(30000), "ychydig eiliadau yn ôl", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "mewn ychydig eiliadau", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "mewn 5 diwrnod", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "same day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "same next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "same last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "same all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:cy"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:cy"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ain', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1af', "Jan 2 2012 should be week 1");
<ide><path>test/lang/da.js
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober okt_november nov_december dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd [den] Do MMMM YYYY, h:mm:ss a', 'søndag den 14. februar 2010, 3:25:50 pm'],
<ide> ['ddd hA', 'søn 3PM'],
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januar jan_februar feb_marts mar_april apr_maj maj_juni jun_juli jul_august aug_september sep_oktober okt_november nov_december dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'søndag søn sø_mandag man ma_tirsdag tir ti_onsdag ons on_torsdag tor to_fredag fre fr_lørdag lør lø'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "få sekunder", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "et minut", "45 seconds = a minute");
<ide> exports["lang:da"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dage", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "en måned", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "en måned", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "en måned", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "en måned", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 måneder", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 måneder", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 måneder", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "en måned", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 måneder", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 måneder", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "et år", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "et år", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 år", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "et år", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 år", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "om få sekunder", "prefix");
<ide> test.equal(moment(0).from(30000), "få sekunder siden", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "få sekunder siden", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "om få sekunder", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "om 5 dage", "in 5 days");
<ide> test.done();
<ide> exports["lang:da"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:da"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/de.js
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'Sonntag, 14. Februar 2010, 3:25:50 pm'],
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'Januar Jan._Februar Febr._März Mrz._April Apr._Mai Mai_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Sonntag So. So_Montag Mo. Mo_Dienstag Di. Di_Mittwoch Mi. Mi_Donnerstag Do. Do_Freitag Fr. Fr_Samstag Sa. Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ein paar Sekunden", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "eine Minute", "45 seconds = a minute");
<ide> exports["lang:de"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 Tage", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ein Monat", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ein Monat", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ein Monat", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ein Monat", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 Monate", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 Monate", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 Monate", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ein Monat", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 Monate", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 Monate", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ein Jahr", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ein Jahr", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 Jahre", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ein Jahr", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 Jahre", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "in ein paar Sekunden", "prefix");
<ide> test.equal(moment(0).from(30000), "vor ein paar Sekunden", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "in ein paar Sekunden", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "in 5 Tagen", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:de"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:de"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/el.js
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.split("_");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(24);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Κυριακή, Φεβρουάριος 14η 2010, 3:25:50 μμ'],
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1η', '1η');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2η', '2η');
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'Ιανουάριος Ιαν_Φεβρουάριος Φεβ_Μάρτιος Μαρ_Απρίλιος Απρ_Μάιος Μαϊ_Ιούνιος Ιουν_Ιούλιος Ιουλ_Αύγουστος Αυγ_Σεπτέμβριος Σεπ_Οκτώβριος Οκτ_Νοέμβριος Νοε_Δεκέμβριος Δεκ'.split("_");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'Κυριακή Κυρ Κυ_Δευτέρα Δευ Δε_Τρίτη Τρι Τρ_Τετάρτη Τετ Τε_Πέμπτη Πεμ Πε_Παρασκευή Παρ Πα_Σάββατο Σαβ Σα'.split("_");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:el"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 μέρες", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ένας μήνας", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ένας μήνας", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ένας μήνας", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ένας μήνας", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 μήνες", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 μήνες", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 μήνες", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ένας μήνας", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 μήνες", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 μήνες", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ένας χρόνος", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ένας χρόνος", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 χρόνια", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ένας χρόνος", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 χρόνια", "5 years = 5 years");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "σε δευτερόλεπτα", "prefix");
<ide> test.equal(moment(0).from(30000), "δευτερόλεπτα πριν", "suffix");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "δευτερόλεπτα πριν", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "σε δευτερόλεπτα", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "σε 5 μέρες", "in 5 days");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(20);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:el"] = {
<ide> // The week that contains Jan 4st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 52, "Dec 31 2006 should be week 52");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 30]).week(), 52, "Dec 30 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 52, "Dec 29 2002 should be week 52");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 52, "Dec 28 2008 should be week 52");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(7);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 52, "Dec 27 2009 should be week 52");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 51, "Dec 26 2010 should be week 51");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:el"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52η', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1η', "Jan 7 2012 should be week 1");
<ide><path>test/lang/en-au.js
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'Sun, 3PM'],
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "a few seconds", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "a minute", "45 seconds = a minute");
<ide> exports["lang:en-au"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 days", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "a month", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "a month", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "a month", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "a month", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 months", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 months", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 months", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "a month", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 months", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 months", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "a year", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "a year", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 years", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "a year", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 years", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "in a few seconds", "prefix");
<ide> test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "in a few seconds", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "in 5 days", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:en-au"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:en-au"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', "Jan 2 2012 should be week 1");
<ide><path>test/lang/en-ca.js
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "a few seconds", "44 seconds = a few seconds");
<ide> exports["lang:en-ca"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 days", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "a month", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "a month", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "a month", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "a month", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 months", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 months", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 months", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "a month", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 months", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 months", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "a year", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "a year", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 years", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "a year", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 years", "5 years = 5 years");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "in a few seconds", "prefix");
<ide> test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "in a few seconds", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "in 5 days", "in 5 days");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:en-ca"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:en-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', "Jan 7 2012 should be week 1");
<ide><path>test/lang/en-gb.js
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'Sun, 3PM'],
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3rd', '3rd');
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "a few seconds", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "a minute", "45 seconds = a minute");
<ide> exports["lang:en-gb"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 days", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "a month", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "a month", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "a month", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "a month", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 months", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 months", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 months", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "a month", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 months", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 months", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "a year", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "a year", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 years", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "a year", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 years", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "in a few seconds", "prefix");
<ide> test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "in a few seconds", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "in 5 days", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:en-gb"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:en-gb"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52nd', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1st', "Jan 2 2012 should be week 1");
<ide><path>test/lang/en.js
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Sunday, February 14th 2010, 3:25:50 pm'],
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1st', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2nd', '2nd');
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'January Jan_February Feb_March Mar_April Apr_May May_June Jun_July Jul_August Aug_September Sep_October Oct_November Nov_December Dec'.split("_");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'Sunday Sun Su_Monday Mon Mo_Tuesday Tue Tu_Wednesday Wed We_Thursday Thu Th_Friday Fri Fr_Saturday Sat Sa'.split("_");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:en"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 days", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "a month", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "a month", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "a month", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "a month", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 months", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 months", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 months", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "a month", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 months", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 months", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "a year", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "a year", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 years", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "a year", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 years", "5 years = 5 years");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "in a few seconds", "prefix");
<ide> test.equal(moment(0).from(30000), "a few seconds ago", "suffix");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "a few seconds ago", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "in a few seconds", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "in 5 days", "in 5 days");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:en"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:en"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1st', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1st', "Jan 7 2012 should be week 1");
<ide><path>test/lang/eo.js
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Dimanĉo, februaro 14a 2010, 3:25:50 p.t.m.'],
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a');
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'januaro jan_februaro feb_marto mar_aprilo apr_majo maj_junio jun_julio jul_aŭgusto aŭg_septembro sep_oktobro okt_novembro nov_decembro dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Dimanĉo Dim Di_Lundo Lun Lu_Mardo Mard Ma_Merkredo Merk Me_Ĵaŭdo Ĵaŭ Ĵa_Vendredo Ven Ve_Sabato Sab Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "sekundoj", "44 seconds = a few seconds");
<ide> exports["lang:eo"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 tagoj", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "monato", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "monato", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "monato", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "monato", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 monatoj", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 monatoj", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 monatoj", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "monato", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 monatoj", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 monatoj", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "jaro", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "jaro", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 jaroj", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "jaro", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 jaroj", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "je sekundoj", "je prefix");
<ide> test.equal(moment(0).from(30000), "antaŭ sekundoj", "antaŭ prefix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "antaŭ sekundoj", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "je sekundoj", "je sekundoj");
<ide> test.equal(moment().add({d: 5}).fromNow(), "je 5 tagoj", "je 5 tagoj");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:eo"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:eo"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1a', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1a', "Jan 1 2012 should be week 1");
<ide><path>test/lang/es.js
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(23);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, febrero 14º 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'dom., 3PM'],
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'enero ene._febrero feb._marzo mar._abril abr._mayo may._junio jun._julio jul._agosto ago._septiembre sep._octubre oct._noviembre nov._diciembre dic.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'domingo dom. Do_lunes lun. Lu_martes mar. Ma_miércoles mié. Mi_jueves jue. Ju_viernes vie. Vi_sábado sáb. Sá'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "unos segundos", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "un minuto", "45 seconds = a minute");
<ide> exports["lang:es"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 días", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mes", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mes", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mes", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mes", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meses", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meses", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 meses", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mes", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 meses", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 meses", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un año", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un año", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 años", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un año", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 años", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "en unos segundos", "prefix");
<ide> test.equal(moment(0).from(30000), "hace unos segundos", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "hace unos segundos", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "en unos segundos", "en unos segundos");
<ide> test.equal(moment().add({d: 5}).fromNow(), "en 5 días", "en 5 días");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(7);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:es"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:es"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', "Jan 2 2012 should be week 1");
<ide><path>test/lang/et.js
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, H:mm:ss', 'pühapäev, 14. veebruar 2010, 15:25:50'],
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'jaanuar jaan_veebruar veebr_märts märts_aprill apr_mai mai_juuni juuni_juuli juuli_august aug_september sept_oktoober okt_november nov_detsember dets'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'pühapäev P P_esmaspäev E E_teisipäev T T_kolmapäev K K_neljapäev N N_reede R R_laupäev L L'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "paar sekundit", "44 seconds = paar sekundit");
<ide> exports["lang:et"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 päeva", "25 days = 25 päeva");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "üks kuu", "26 days = üks kuu");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "üks kuu", "30 days = üks kuu");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "üks kuu", "45 days = üks kuu");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "üks kuu", "43 days = üks kuu");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 kuud", "46 days = 2 kuud");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 kuud", "75 days = 2 kuud");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 kuud", "76 days = 3 kuud");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "üks kuu", "1 month = üks kuu");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 kuud", "5 months = 5 kuud");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 kuud", "344 days = 11 kuud");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "üks aasta", "345 days = üks aasta");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "üks aasta", "547 days = üks aasta");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 aastat", "548 days = 2 aastat");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "üks aasta", "1 year = üks aasta");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 aastat", "5 years = 5 aastat");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "mõne sekundi pärast", "prefix");
<ide> test.equal(moment(0).from(30000), "mõni sekund tagasi", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "mõni sekund tagasi", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(18);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "mõne sekundi pärast", "in a few seconds");
<ide> test.equal(moment().subtract({s: 30}).fromNow(), "mõni sekund tagasi", "a few seconds ago");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:et"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:et"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/eu.js
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'igandea, otsaila 14. 2010, 3:25:50 pm'],
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'urtarrila urt._otsaila ots._martxoa mar._apirila api._maiatza mai._ekaina eka._uztaila uzt._abuztua abu._iraila ira._urria urr._azaroa aza._abendua abe.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'igandea ig. ig_astelehena al. al_asteartea ar. ar_asteazkena az. az_osteguna og. og_ostirala ol. ol_larunbata lr. lr'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "segundo batzuk", "44 seconds = a few seconds");
<ide> exports["lang:eu"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 egun", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "hilabete bat", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "hilabete bat", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "hilabete bat", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "hilabete bat", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 hilabete", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 hilabete", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 hilabete", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "hilabete bat", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 hilabete", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 hilabete", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "urte bat", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "urte bat", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 urte", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "urte bat", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 urte", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "segundo batzuk barru", "prefix");
<ide> test.equal(moment(0).from(30000), "duela segundo batzuk", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "duela segundo batzuk", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "segundo batzuk barru", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 egun barru", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:eu"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:eu"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/fa.js
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(24);
<ide> var tests = 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1) + ' instead is month ' + moment(input, mmm).month());
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'یک\u200cشنبه، فوریه ۱۴م ۲۰۱۰، ۳:۲۵:۵۰ بعد از ظهر'],
<ide> ['ddd, hA', 'یک\u200cشنبه، ۳بعد از ظهر'],
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '۱م', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '۲م', '2');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '۳م', '3');
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'ژانویه ژانویه_فوریه فوریه_مارس مارس_آوریل آوریل_مه مه_ژوئن ژوئن_ژوئیه ژوئیه_اوت اوت_سپتامبر سپتامبر_اکتبر اکتبر_نوامبر نوامبر_دسامبر دسامبر'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'یک\u200cشنبه یک\u200cشنبه ی_دوشنبه دوشنبه د_سه\u200cشنبه سه\u200cشنبه س_چهارشنبه چهارشنبه چ_پنج\u200cشنبه پنج\u200cشنبه پ_جمعه جمعه ج_شنبه شنبه ش'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "چندین ثانیه", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "یک دقیقه", "45 seconds = a minute");
<ide> exports["lang:fa"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "۲۵ روز", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "یک ماه", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "یک ماه", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "یک ماه", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "یک ماه", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "۲ ماه", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "۲ ماه", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "۳ ماه", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "یک ماه", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "۵ ماه", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "۱۱ ماه", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "یک سال", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "یک سال", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "۲ سال", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "یک سال", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "۵ سال", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "در چندین ثانیه", "prefix");
<ide> test.equal(moment(0).from(30000), "چندین ثانیه پیش", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "چندین ثانیه پیش", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "در چندین ثانیه", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "در ۵ روز", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:fa"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).week(), 1, "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).week(), 1, "Jan 6 2012 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2006, 11, 30]).week(), 1, "Dec 30 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 5]).week(), 1, "Jan 5 2007 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 1, "Dec 29 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 28]).week(), 1, "Dec 28 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 27]).week(), 1, "Dec 27 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 11, 26]).week(), 1, "Dec 26 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> test.equal(moment([2011, 0, 7]).week(), 1, "Jan 7 2011 should be week 1");
<ide> exports["lang:fa"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).format('w ww wo'), '۱ ۰۱ ۱م', "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).format('w ww wo'), '۱ ۰۱ ۱م', "Jan 6 2012 should be week 1");
<ide><path>test/lang/fi.js
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'sunnuntai, helmikuu 14. 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'su, 3PM'],
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2nd');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3rd');
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'tammikuu tammi_helmikuu helmi_maaliskuu maalis_huhtikuu huhti_toukokuu touko_kesäkuu kesä_heinäkuu heinä_elokuu elo_syyskuu syys_lokakuu loka_marraskuu marras_joulukuu joulu'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'sunnuntai su su_maanantai ma ma_tiistai ti ti_keskiviikko ke ke_torstai to to_perjantai pe pe_lauantai la la'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "muutama sekunti", "44 seconds = few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "minuutti", "45 seconds = a minute");
<ide> exports["lang:fi"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 päivää", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "kuukausi", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "kuukausi", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "kuukausi", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "kuukausi", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "kaksi kuukautta", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "kaksi kuukautta", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "kolme kuukautta", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "kuukausi", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "viisi kuukautta", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 kuukautta", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "vuosi", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "vuosi", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "kaksi vuotta", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "vuosi", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "viisi vuotta", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "muutaman sekunnin päästä", "prefix");
<ide> test.equal(moment(0).from(30000), "muutama sekunti sitten", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "muutama sekunti sitten", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "muutaman sekunnin päästä", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "viiden päivän päästä", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:fi"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:fi"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/fo.js
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd [tann] Do MMMM YYYY, h:mm:ss a', 'sunnudagur tann 14. februar 2010, 3:25:50 pm'],
<ide> ['ddd hA', 'sun 3PM'],
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januar jan_februar feb_mars mar_apríl apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'sunnudagur sun su_mánadagur mán má_týsdagur týs tý_mikudagur mik mi_hósdagur hós hó_fríggjadagur frí fr_leygardagur ley le'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "fá sekund", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "ein minutt", "45 seconds = a minute");
<ide> exports["lang:fo"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dagar", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ein mánaði", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ein mánaði", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ein mánaði", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ein mánaði", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mánaðir", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mánaðir", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mánaðir", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ein mánaði", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mánaðir", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mánaðir", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "eitt ár", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "eitt ár", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ár", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "eitt ár", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ár", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "um fá sekund", "prefix");
<ide> test.equal(moment(0).from(30000), "fá sekund síðani", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "fá sekund síðani", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "um fá sekund", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "um 5 dagar", "in 5 days");
<ide> test.done();
<ide> exports["lang:fo"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:fo"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/fr-ca.js
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14 2010, 3:25:50 pm'],
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split("_");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:fr-ca"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 jours", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mois", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mois", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mois", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mois", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mois", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mois", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mois", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mois", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mois", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mois", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un an", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un an", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ans", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un an", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ans", "5 years = 5 years");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "dans quelques secondes", "prefix");
<ide> test.equal(moment(0).from(30000), "il y a quelques secondes", "suffix");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "dans quelques secondes", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "dans 5 jours", "in 5 days");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "same day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "same next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "same last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "same all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:fr-ca"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:fr-ca"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1er', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1er', "Jan 7 2012 should be week 1");
<ide><path>test/lang/fr.js
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_"),
<ide> i;
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'dimanche, février 14 2010, 3:25:50 pm'],
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1er', '1er');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'janvier janv._février févr._mars mars_avril avr._mai mai_juin juin_juillet juil._août août_septembre sept._octobre oct._novembre nov._décembre déc.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'dimanche dim. Di_lundi lun. Lu_mardi mar. Ma_mercredi mer. Me_jeudi jeu. Je_vendredi ven. Ve_samedi sam. Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "quelques secondes", "44 seconds = a few seconds");
<ide> exports["lang:fr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 jours", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mois", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mois", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mois", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mois", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mois", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mois", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mois", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mois", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mois", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mois", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un an", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un an", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ans", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un an", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ans", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "dans quelques secondes", "prefix");
<ide> test.equal(moment(0).from(30000), "il y a quelques secondes", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "dans quelques secondes", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "dans 5 jours", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "same day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "same next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "same last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "same all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:fr"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:fr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1er', "Jan 2 2012 should be week 1");
<ide><path>test/lang/gl.js
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = "Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Outubro Out._Novembro Nov._Decembro Dec.".split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = "Xaneiro Xan._Febreiro Feb._Marzo Mar._Abril Abr._Maio Mai._Xuño Xuñ._Xullo Xul._Agosto Ago._Setembro Set._Outubro Out._Novembro Nov._Decembro Dec.".split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = "Domingo Dom. Do_Luns Lun. Lu_Martes Mar. Ma_Mércores Mér. Mé_Xoves Xov. Xo_Venres Ven. Ve_Sábado Sáb. Sá".split("_"),
<ide> i;
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:gl"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 días", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mes", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mes", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mes", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mes", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meses", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meses", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 meses", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mes", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 meses", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 meses", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un ano", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un ano", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 anos", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un ano", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 anos", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "nuns segundos", "prefix");
<ide> test.equal(moment(0).from(30000), "hai uns segundos", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "hai uns segundos", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "nuns segundos", "en unos segundos");
<ide> test.equal(moment().add({d: 5}).fromNow(), "en 5 días", "en 5 días");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(7);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "regression tests" : function (test) {
<del> test.expect(1);
<ide>
<ide> var lastWeek = moment().subtract({ d: 4 }).hours(1);
<ide> test.equal(lastWeek.calendar(), lastWeek.format('[o] dddd [pasado a] LT'), "1 o'clock bug");
<ide> exports["lang:gl"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:gl"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1º', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', "Jan 1 2012 should be week 1");
<ide><path>test/lang/he.js
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'ראשון, פברואר 14 2010, 3:25:50 pm'],
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'ינואר ינו׳_פברואר פבר׳_מרץ מרץ_אפריל אפר׳_מאי מאי_יוני יוני_יולי יולי_אוגוסט אוג׳_ספטמבר ספט׳_אוקטובר אוק׳_נובמבר נוב׳_דצמבר דצמ׳'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'ראשון א׳ א|שני ב׳ ב|שלישי ג׳ ג|רביעי ד׳ ד|חמישי ה׳ ה|שישי ו׳ ו|שבת ש׳ ש'.split("|"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "מספר שניות", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "דקה", "45 seconds = a minute");
<ide> exports["lang:he"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ימים", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "חודש", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "חודש", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "חודש", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "חודש", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "חודשיים", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "חודשיים", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 חודשים", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "חודש", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 חודשים", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 חודשים", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "שנה", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "שנה", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "שנתיים", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "שנה", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 שנים", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "בעוד מספר שניות", "prefix");
<ide> test.equal(moment(0).from(30000), "לפני מספר שניות", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "לפני מספר שניות", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "בעוד מספר שניות", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "בעוד 5 ימים", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:he"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:he"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', "Jan 7 2012 should be week 1");
<ide><path>test/lang/hi.js
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(21);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, a h:mm:ss बजे', 'रविवार, १४ फ़रवरी २०१०, दोपहर ३:२५:५० बजे'],
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२');
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'जनवरी जन._फ़रवरी फ़र._मार्च मार्च_अप्रैल अप्रै._मई मई_जून जून_जुलाई जुल._अगस्त अग._सितम्बर सित._अक्टूबर अक्टू._नवम्बर नव._दिसम्बर दिस.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'रविवार रवि र_सोमवार सोम सो_मंगलवार मंगल मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "कुछ ही क्षण", "44 seconds = a few seconds");
<ide> exports["lang:hi"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "२५ दिन", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "एक महीने", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "एक महीने", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "एक महीने", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "एक महीने", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "२ महीने", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "२ महीने", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "३ महीने", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "एक महीने", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "५ महीने", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "११ महीने", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "एक वर्ष", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "एक वर्ष", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "२ वर्ष", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "एक वर्ष", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "५ वर्ष", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "कुछ ही क्षण में", "prefix");
<ide> test.equal(moment(0).from(30000), "कुछ ही क्षण पहले", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "कुछ ही क्षण पहले", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "कुछ ही क्षण में", "कुछ ही क्षण में");
<ide> test.equal(moment().add({d: 5}).fromNow(), "५ दिन में", "५ दिन में");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(12);
<ide>
<ide> test.equal(moment([2011, 2, 23, 2, 30]).format('a'), "रात", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 9, 30]).format('a'), "सुबह", "morning");
<ide> exports["lang:hi"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:hi"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', "Jan 7 2012 should be week 1");
<ide><path>test/lang/hr.js
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'sječanj sje._veljača vel._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedjelja, 14. veljača 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'ned., 3PM'],
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'sječanj sje._veljača vel._ožujak ožu._travanj tra._svibanj svi._lipanj lip._srpanj srp._kolovoz kol._rujan ruj._listopad lis._studeni stu._prosinac pro.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'nedjelja ned. ne_ponedjeljak pon. po_utorak uto. ut_srijeda sri. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "par sekundi", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "jedna minuta", "45 seconds = a minute");
<ide> exports["lang:hr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dana", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mjesec", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mjesec", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mjesec", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mjesec", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mjeseca", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mjeseca", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mjeseca", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mjesec", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mjeseci", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mjeseci", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "godinu", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "godinu", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 godine", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "godinu", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 godina", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za par sekundi", "prefix");
<ide> test.equal(moment(0).from(30000), "prije par sekundi", "prefix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "prije par sekundi", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za par sekundi", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "za 5 dana", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:hr"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:hr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/hu.js
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split("_"),
<ide> i;
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(20);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, HH:mm:ss', 'vasárnap, február 14. 2010, 15:25:50'],
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(8);
<ide>
<ide> test.equal(moment([2011, 2, 23, 0, 0]).format('a'), "de", "am");
<ide> test.equal(moment([2011, 2, 23, 11, 59]).format('a'), "de", "am");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'január jan_február feb_március márc_április ápr_május máj_június jún_július júl_augusztus aug_szeptember szept_október okt_november nov_december dec'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'vasárnap vas_hétfő hét_kedd kedd_szerda sze_csütörtök csüt_péntek pén_szombat szo'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "néhány másodperc", "44 másodperc = néhány másodperc");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "egy perc", "45 másodperc = egy perc");
<ide> exports["lang:hu"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 nap", "25 nap = 25 nap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "egy hónap", "26 nap = egy hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "egy hónap", "30 nap = egy hónap");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "egy hónap", "45 nap = egy hónap");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "egy hónap", "45 nap = egy hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 hónap", "46 nap = 2 hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 hónap", "75 nap = 2 hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 hónap", "76 nap = 3 hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "egy hónap", "1 hónap = egy hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 hónap", "5 hónap = 5 hónap");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 hónap", "344 nap = 11 hónap");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "egy év", "345 nap = egy év");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "egy év", "547 nap = egy év");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 év", "548 nap = 2 év");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "egy év", "1 év = egy év");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 év", "5 év = 5 év");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "néhány másodperc múlva", "prefix");
<ide> test.equal(moment(0).from(30000), "néhány másodperce", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "néhány másodperce", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "néhány másodperc múlva", "néhány másodperc múlva");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 nap múlva", "5 nap múlva");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_');
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, days = 'vasárnap_hétfőn_kedden_szerdán_csütörtökön_pénteken_szombaton'.split('_');
<ide>
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:hu"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:hu"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/hy-am.js
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, HH:mm:ss', 'կիրակի, 14 փետրվարի 2010, 15:25:50'],
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format meridiem" : function (test) {
<del> test.expect(8);
<ide>
<ide> test.equal(moment([2012, 11, 28, 0, 0]).format("A"), "գիշերվա", "night");
<ide> test.equal(moment([2012, 11, 28, 3, 59]).format("A"), "գիշերվա", "night");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-ին', '1-ին');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-րդ', '2-րդ');
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'հունվար հնվ_փետրվար փտր_մարտ մրտ_ապրիլ ապր_մայիս մյս_հունիս հնս_հուլիս հլս_օգոստոս օգս_սեպտեմբեր սպտ_հոկտեմբեր հկտ_նոյեմբեր նմբ_դեկտեմբեր դկտ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format month case" : function (test) {
<del> test.expect(24);
<ide>
<ide> var months = {
<ide> 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'),
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format month short case" : function (test) {
<del> test.expect(24);
<ide>
<ide> var monthsShort = {
<ide> 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format month case with escaped symbols" : function (test) {
<del> test.expect(48);
<ide>
<ide> var months = {
<ide> 'nominative': 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_'),
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format month short case with escaped symbols" : function (test) {
<del> test.expect(48);
<ide>
<ide> var monthsShort = {
<ide> 'nominative': 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'կիրակի կրկ կրկ_երկուշաբթի երկ երկ_երեքշաբթի երք երք_չորեքշաբթի չրք չրք_հինգշաբթի հնգ հնգ_ուրբաթ ուրբ ուրբ_շաբաթ շբթ շբթ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(32);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "մի քանի վայրկյան", "44 seconds = seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "րոպե", "45 seconds = a minute");
<ide> exports["lang:hy-am"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 օր", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ամիս", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ամիս", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ամիս", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ամիս", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 ամիս", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 ամիս", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 ամիս", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ամիս", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 ամիս", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 ամիս", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "տարի", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "տարի", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 տարի", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "տարի", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 տարի", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "մի քանի վայրկյան հետո", "prefix");
<ide> test.equal(moment(0).from(30000), "մի քանի վայրկյան առաջ", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "մի քանի վայրկյան հետո", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 օր հետո", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> function makeFormat(d) {
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:hy-am"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:hy-am"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ին', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ին', "Jan 1 2012 should be week 1");
<ide><path>test/lang/id.js
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Minggu, Februari 14 2010, 3:25:50 sore'],
<ide> ['ddd, hA', 'Min, 3sore'],
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'Januari Jan_Februari Feb_Maret Mar_April Apr_Mei Mei_Juni Jun_Juli Jul_Agustus Ags_September Sep_Oktober Okt_November Nov_Desember Des'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'Minggu Min Mg_Senin Sen Sn_Selasa Sel Sl_Rabu Rab Rb_Kamis Kam Km_Jumat Jum Jm_Sabtu Sab Sb'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "beberapa detik", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "semenit", "45 seconds = a minute");
<ide> exports["lang:id"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 hari", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "sebulan", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "sebulan", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "sebulan", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "sebulan", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 bulan", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 bulan", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 bulan", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "sebulan", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 bulan", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 bulan", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "setahun", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "setahun", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 tahun", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "setahun", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 tahun", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "dalam beberapa detik", "prefix");
<ide> test.equal(moment(0).from(30000), "beberapa detik yang lalu", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "beberapa detik yang lalu", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "dalam beberapa detik", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "dalam 5 hari", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:id"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:id"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide><path>test/lang/is.js
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'sunnudagur, 14. febrúar 2010, 3:25:50 pm'],
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'janúar jan_febrúar feb_mars mar_apríl apr_maí maí_júní jún_júlí júl_ágúst ágú_september sep_október okt_nóvember nóv_desember des'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'sunnudagur sun Su_mánudagur mán Má_þriðjudagur þri Þr_miðvikudagur mið Mi_fimmtudagur fim Fi_föstudagur fös Fö_laugardagur lau La'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(34);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "nokkrar sekúndur", "44 seconds = a few seconds");
<ide> exports["lang:is"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 21}), true), "21 dagur", "21 days = 21 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mánuður", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mánuður", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mánuður", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mánuður", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mánuðir", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mánuðir", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mánuðir", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mánuður", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mánuðir", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mánuðir", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ár", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ár", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ár", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ár", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ár", "5 years = 5 years");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(3);
<ide> test.equal(moment(30000).from(0), "eftir nokkrar sekúndur", "prefix");
<ide> test.equal(moment(0).from(30000), "fyrir nokkrum sekúndum síðan", "suffix");
<ide> test.equal(moment().subtract({m: 1}).fromNow(), "fyrir mínútu síðan", "a minute ago");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "fyrir nokkrum sekúndum síðan", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(3);
<ide> test.equal(moment().add({s: 30}).fromNow(), "eftir nokkrar sekúndur", "in a few seconds");
<ide> test.equal(moment().add({m: 1}).fromNow(), "eftir mínútu", "in a minute");
<ide> test.equal(moment().add({d: 5}).fromNow(), "eftir 5 daga", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:is"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:is"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/it.js
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Domenica, febbraio 14º 2010, 3:25:50 pm'],
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'gennaio gen_febbraio feb_marzo mar_aprile apr_maggio mag_giugno giu_luglio lug_agosto ago_settembre set_ottobre ott_novembre nov_dicembre dic'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Domenica Dom D_Lunedì Lun L_Martedì Mar Ma_Mercoledì Mer Me_Giovedì Gio G_Venerdì Ven V_Sabato Sab S'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "alcuni secondi", "44 seconds = seconds");
<ide> exports["lang:it"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 giorni", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "un mese", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "un mese", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "un mese", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "un mese", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mesi", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mesi", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mesi", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "un mese", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mesi", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mesi", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un anno", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un anno", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 anni", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un anno", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 anni", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "in alcuni secondi", "prefix");
<ide> test.equal(moment(0).from(30000), "alcuni secondi fa", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "in alcuni secondi", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "tra 5 giorni", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:it"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:it"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', "Jan 2 2012 should be week 1");
<ide><path>test/lang/ja.js
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, a h:mm:ss', '日曜日, 2月 14 2010, 午後 3:25:50'],
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = '1月 1月_2月 2月_3月 3月_4月 4月_5月 5月_6月 6月_7月 7月_8月 8月_9月 9月_10月 10月_11月 11月_12月 12月'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = '日曜日 日 日_月曜日 月 月_火曜日 火 火_水曜日 水 水_木曜日 木 木_金曜日 金 金_土曜日 土 土'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "数秒", "44 seconds = a few seconds");
<ide> exports["lang:ja"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25日", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "1ヶ月", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "1ヶ月", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "1ヶ月", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "1ヶ月", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2ヶ月", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2ヶ月", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3ヶ月", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "1ヶ月", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5ヶ月", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11ヶ月", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "1年", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "1年", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2年", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "1年", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5年", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "数秒後", "prefix");
<ide> test.equal(moment(0).from(30000), "数秒前", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "数秒前", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "数秒後", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5日後", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ja"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ja"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', "Jan 7 2012 should be week 1");
<ide><path>test/lang/ka.js
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.split("_");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'კვირა, თებერვალი მე-14 2010, 3:25:50 pm'],
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(35);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-ლი', '1-ლი');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), 'მე-2', 'მე-2');
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'იანვარი იან_თებერვალი თებ_მარტი მარ_აპრილი აპრ_მაისი მაი_ივნისი ივნ_ივლისი ივლ_აგვისტო აგვ_სექტემბერი სექ_ოქტომბერი ოქტ_ნოემბერი ნოე_დეკემბერი დეკ'.split("_");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'კვირა კვი კვ_ორშაბათი ორშ ორ_სამშაბათი სამ სა_ოთხშაბათი ოთხ ოთ_ხუთშაბათი ხუთ ხუ_პარასკევი პარ პა_შაბათი შაბ შა'.split("_");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:ka"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 დღე", "25 დღე = 25 დღე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "თვე", "26 დღე = თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "თვე", "30 დღე = თვე");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "თვე", "45 დღე = თვე");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "თვე", "45 დღე = თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 თვე", "46 დღე = 2 თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 თვე", "75 დღე = 2 თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 თვე", "76 დღე = 3 თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "თვე", "1 თვე = თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 თვე", "5 თვე = 5 თვე");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 თვე", "344 დღე = 11 თვე");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "წელი", "345 დღე = წელი");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "წელი", "547 დღე = წელი");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 წელი", "548 დღე = 2 წელი");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "წელი", "1 წელი = წელი");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 წელი", "5 წელი = 5 წელი");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "რამდენიმე წამში", "ში სუფიქსი");
<ide> test.equal(moment(0).from(30000), "რამდენიმე წამის წინ", "წინ სუფიქსი");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "რამდენიმე წამის წინ", "უნდა აჩვენოს როგორც წარსული");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "რამდენიმე წამში", "რამდენიმე წამში");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 დღეში", "5 დღეში");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "დეკ 26 2011 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "იან 1 2012 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "იან 1 2007 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "იან 7 2007 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "დეკ 31 2007 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "იან 1 2008 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "დეკ 30 2002 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "იან 1 2003 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "დეკ 29 2008 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "იან 1 2009 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "დეკ 28 2009 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "იან 1 2010 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "დეკ 27 2010 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "იან 1 2011 უნდა იყოს კვირა 1");
<ide> exports["lang:ka"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ლი', "დეკ 26 2011 უნდა იყოს კვირა 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ლი', "იან 1 2012 უნდა იყოს კვირა 1");
<ide><path>test/lang/km.js
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "parse": function (test) {
<del> test.expect(96);
<ide> var tests = 'មករា មករា_កុម្ភៈ កុម្ភៈ_មិនា មិនា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split("_"),
<ide> i;
<ide>
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "format": function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'អាទិត្យ, កុម្ភៈ 14 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'អាទិត្យ, 3PM'],
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "format ordinal": function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2nd');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3rd');
<ide> exports["lang:km"] = {
<ide> test.equal(moment([2011, 0, 18]).format('DDDo'), '18', '18th');
<ide> test.equal(moment([2011, 0, 19]).format('DDDo'), '19', '19th');
<ide> test.equal(moment([2011, 0, 20]).format('DDDo'), '20', '20th');
<del>
<add>
<ide> test.equal(moment([2011, 0, 21]).format('DDDo'), '21', '21st');
<ide> test.equal(moment([2011, 0, 22]).format('DDDo'), '22', '22nd');
<ide> test.equal(moment([2011, 0, 23]).format('DDDo'), '23', '23rd');
<ide> exports["lang:km"] = {
<ide> test.equal(moment([2011, 0, 28]).format('DDDo'), '28', '28th');
<ide> test.equal(moment([2011, 0, 29]).format('DDDo'), '29', '29th');
<ide> test.equal(moment([2011, 0, 30]).format('DDDo'), '30', '30th');
<del>
<add>
<ide> test.equal(moment([2011, 0, 31]).format('DDDo'), '31', '31st');
<ide> test.done();
<ide> },
<ide>
<ide> "format month": function (test) {
<del> test.expect(12);
<ide> var expected = 'មករា មករា_កុម្ភៈ កុម្ភៈ_មិនា មិនា_មេសា មេសា_ឧសភា ឧសភា_មិថុនា មិថុនា_កក្កដា កក្កដា_សីហា សីហា_កញ្ញា កញ្ញា_តុលា តុលា_វិច្ឆិកា វិច្ឆិកា_ធ្នូ ធ្នូ'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "format week": function (test) {
<del> test.expect(7);
<ide> var expected = 'អាទិត្យ អាទិត្យ អាទិត្យ_ច័ន្ទ ច័ន្ទ ច័ន្ទ_អង្គារ អង្គារ អង្គារ_ពុធ ពុធ ពុធ_ព្រហស្បតិ៍ ព្រហស្បតិ៍ ព្រហស្បតិ៍_សុក្រ សុក្រ សុក្រ_សៅរ៍ សៅរ៍ សៅរ៍'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "from": function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> s: 44
<del> }), true), "ប៉ុន្មានវិនាទី", "44 seconds = ប៉ុន្មានវិនាទី");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> s: 45
<del> }), true), "មួយនាទី", "45 seconds = មួយនាទី");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> s: 89
<del> }), true), "មួយនាទី", "89 seconds = មួយនាទី");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> s: 90
<del> }), true), "2 នាទី", "90 seconds = 2 នាទី");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> m: 44
<del> }), true), "44 នាទី", "44 minutes = 44 នាទី");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> m: 45
<del> }), true), "មួយម៉ោង", "45 minutes = មួយម៉ោង");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> m: 89
<del> }), true), "មួយម៉ោង", "89 minutes = មួយម៉ោង");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> m: 90
<del> }), true), "2 ម៉ោង", "90 minutes = 2 ម៉ោង");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> h: 5
<del> }), true), "5 ម៉ោង", "5 hours = 5 ម៉ោង");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> h: 21
<del> }), true), "21 ម៉ោង", "21 hours = 21 ម៉ោង");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> h: 22
<del> }), true), "មួយថ្ងៃ", "22 hours = មួយថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> h: 35
<del> }), true), "មួយថ្ងៃ", "35 hours = មួយថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> h: 36
<del> }), true), "2 ថ្ងៃ", "36 hours = 2 ថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 1
<del> }), true), "មួយថ្ងៃ", "1 day = មួយថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 5
<del> }), true), "5 ថ្ងៃ", "5 days = 5 ថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 25
<del> }), true), "25 ថ្ងៃ", "25 days = 25 ថ្ងៃ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 26
<del> }), true), "មួយខែ", "26 days = មួយខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 30
<del> }), true), "មួយខែ", "30 days = មួយខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 45
<del> }), true), "មួយខែ", "45 days = មួយខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 46
<del> }), true), "2 ខែ", "46 days = 2 ខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 74
<del> }), true), "2 ខែ", "75 days = 2 ខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 76
<del> }), true), "3 ខែ", "76 days = 3 ខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> M: 1
<del> }), true), "មួយខែ", "1 month = មួយខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> M: 5
<del> }), true), "5 ខែ", "5 months = 5 ខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 344
<del> }), true), "11 ខែ", "344 days = 11 ខែ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 345
<del> }), true), "មួយឆ្នាំ", "345 days = មួយឆ្នាំ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 547
<del> }), true), "មួយឆ្នាំ", "547 days = មួយឆ្នាំ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> d: 548
<del> }), true), "2 ឆ្នាំ", "548 days = 2 ឆ្នាំ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> y: 1
<del> }), true), "មួយឆ្នាំ", "1 year = មួយឆ្នាំ");
<del> test.equal(start.from(moment([2007, 1, 28]).add({
<del> y: 5
<del> }), true), "5 ឆ្នាំ", "5 years = 5 ឆ្នាំ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ s: 44 }), true), "ប៉ុន្មានវិនាទី", "44 seconds = ប៉ុន្មានវិនាទី");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ s: 45 }), true), "មួយនាទី", "45 seconds = មួយនាទី");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ s: 89 }), true), "មួយនាទី", "89 seconds = មួយនាទី");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ s: 90 }), true), "2 នាទី", "90 seconds = 2 នាទី");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ m: 44 }), true), "44 នាទី", "44 minutes = 44 នាទី");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ m: 45 }), true), "មួយម៉ោង", "45 minutes = មួយម៉ោង");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ m: 89 }), true), "មួយម៉ោង", "89 minutes = មួយម៉ោង");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ m: 90 }), true), "2 ម៉ោង", "90 minutes = 2 ម៉ោង");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ h: 5 }), true), "5 ម៉ោង", "5 hours = 5 ម៉ោង");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ h: 21 }), true), "21 ម៉ោង", "21 hours = 21 ម៉ោង");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ h: 22 }), true), "មួយថ្ងៃ", "22 hours = មួយថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ h: 35 }), true), "មួយថ្ងៃ", "35 hours = មួយថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ h: 36 }), true), "2 ថ្ងៃ", "36 hours = 2 ថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 1 }), true), "មួយថ្ងៃ", "1 day = មួយថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 5 }), true), "5 ថ្ងៃ", "5 days = 5 ថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 25 }), true), "25 ថ្ងៃ", "25 days = 25 ថ្ងៃ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 26 }), true), "មួយខែ", "26 days = មួយខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 30 }), true), "មួយខែ", "30 days = មួយខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 43 }), true), "មួយខែ", "43 days = មួយខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 46 }), true), "2 ខែ", "46 days = 2 ខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 74 }), true), "2 ខែ", "75 days = 2 ខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 76 }), true), "3 ខែ", "76 days = 3 ខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ M: 1 }), true), "មួយខែ", "1 month = មួយខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ M: 5 }), true), "5 ខែ", "5 months = 5 ខែ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 345 }), true), "មួយឆ្នាំ", "345 days = មួយឆ្នាំ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 548 }), true), "2 ឆ្នាំ", "548 days = 2 ឆ្នាំ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ y: 1 }), true), "មួយឆ្នាំ", "1 year = មួយឆ្នាំ");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ y: 5 }), true), "5 ឆ្នាំ", "5 years = 5 ឆ្នាំ");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix": function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "ប៉ុន្មានវិនាទីទៀត", "prefix");
<ide> test.equal(moment(0).from(30000), "ប៉ុន្មានវិនាទីមុន", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now": function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "ប៉ុន្មានវិនាទីមុន", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow": function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({
<ide> s: 30
<ide> }).fromNow(), "ប៉ុន្មានវិនាទីទៀត", "in a few seconds");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "calendar day": function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "calendar next week": function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "calendar last week": function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "calendar all else": function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({
<ide> w: 1
<ide> exports["lang:km"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday": function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting monday": function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday": function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday": function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday": function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting friday": function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday": function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:km"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted": function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', "Jan 2 2012 should be week 1");
<ide><path>test/lang/ko.js
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:kr"] = {
<ide> expected : "16"
<ide> }], i, l, it, actual;
<ide>
<del> test.expect(elements.length);
<ide>
<ide> for (i = 0, l = elements.length; i < l; ++i) {
<ide> it = elements[i];
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['YYYY년 MMMM Do dddd a h:mm:ss', '2010년 2월 14일 일요일 오후 3:25:50'],
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1일', '1일');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2일', '2일');
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = '1월 1월_2월 2월_3월 3월_4월 4월_5월 5월_6월 6월_7월 7월_8월 8월_9월 9월_10월 10월_11월 11월_12월 12월'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = '일요일 일 일_월요일 월 월_화요일 화 화_수요일 수 수_목요일 목 목_금요일 금 금_토요일 토 토'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "몇초", "44초 = 몇초");
<ide> exports["lang:kr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25일", "25일 = 25일");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "한달", "26일 = 한달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "한달", "30일 = 한달");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "한달", "45일 = 한달");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "한달", "45일 = 한달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2달", "46일 = 2달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2달", "75일 = 2달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3달", "76일 = 3달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "한달", "1달 = 한달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5달", "5달 = 5달");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11달", "344일 = 11달");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "일년", "345일 = 일년");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "일년", "547일 = 일년");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2년", "548일 = 2년");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "일년", "일년 = 일년");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5년", "5년 = 5년");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "몇초 후", "prefix");
<ide> test.equal(moment(0).from(30000), "몇초 전", "suffix");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "몇초 전", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "몇초 후", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5일 후", "in 5 days");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:kr"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:kr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1일', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1일', "Jan 7 2012 should be week 1");
<ide><path>test/lang/lb.js
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "parse": function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_"), i;
<ide>
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "format": function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, HH:mm:ss', 'Sonndeg, 14. Februar 2010, 15:25:50'],
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "format month": function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'Januar Jan._Februar Febr._Mäerz Mrz._Abrëll Abr._Mee Mee_Juni Jun._Juli Jul._August Aug._September Sept._Oktober Okt._November Nov._Dezember Dez.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "format week": function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Sonndeg So. So_Méindeg Mé. Mé_Dënschdeg Dë. Dë_Mëttwoch Më. Më_Donneschdeg Do. Do_Freideg Fr. Fr_Samschdeg Sa. Sa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "from": function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "e puer Sekonnen", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "eng Minutt", "45 seconds = a minute");
<ide> exports["lang:lb"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 Deeg", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ee Mount", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ee Mount", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ee Mount", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ee Mount", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 Méint", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 Méint", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 Méint", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ee Mount", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 Méint", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 Méint", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ee Joer", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ee Joer", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 Joer", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ee Joer", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 Joer", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix": function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "an e puer Sekonnen", "prefix");
<ide> test.equal(moment(0).from(30000), "virun e puer Sekonnen", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow": function (test) {
<del> test.expect(13);
<ide> test.equal(moment().add({s: 30}).fromNow(), "an e puer Sekonnen", "in a few seconds");
<ide> test.equal(moment().add({d: 1}).fromNow(), "an engem Dag", "in one day");
<ide> test.equal(moment().add({d: 2}).fromNow(), "an 2 Deeg", "in 2 days");
<ide> exports["lang:lb"] = {
<ide> },
<ide>
<ide> "calendar last week": function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, weekday, datestring;
<ide> for (i = 2; i < 7; i++) {
<ide><path>test/lang/lt.js
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'sausio sau_vasario vas_kovo kov_balandžio bal_gegužės geg_birželio bir_liepos lie_rugpjūčio rgp_rugsėjo rgs_spalio spa_lapkričio lap_gruodžio grd'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'sekmadienis, 14-oji vasario 2010, 3:25:50 pm'],
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-oji', '1-oji');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-oji', '2-oji');
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'sausio sau_vasario vas_kovo kov_balandžio bal_gegužės geg_birželio bir_liepos lie_rugpjūčio rgp_rugsėjo rgs_spalio spa_lapkričio lap_gruodžio grd'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'sekmadienis Sek S_pirmadienis Pir P_antradienis Ant A_trečiadienis Tre T_ketvirtadienis Ket K_penktadienis Pen Pn_šeštadienis Šeš Š'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(37);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "kelios sekundės", "44 seconds = seconds");
<ide> exports["lang:lt"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dienos", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mėnuo", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mėnuo", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mėnuo", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mėnuo", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mėnesiai", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mėnesiai", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mėnesiai", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mėnuo", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mėnesiai", "5 months = 5 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 10}), true), "10 mėnesių", "10 months = 10 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mėnesių", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "metai", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "metai", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 metai", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "metai", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 metai", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "po kelių sekundžių", "prefix");
<ide> test.equal(moment(0).from(30000), "prieš kelias sekundes", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "prieš kelias sekundes", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "po kelių sekundžių", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "po 5 dienų", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:lt"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:lt"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52-oji', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1-oji', "Jan 2 2012 should be week 1");
<ide><path>test/lang/lv.js
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'svētdiena, 14. februāris 2010, 3:25:50 pm'],
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'janvāris jan_februāris feb_marts mar_aprīlis apr_maijs mai_jūnijs jūn_jūlijs jūl_augusts aug_septembris sep_oktobris okt_novembris nov_decembris dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'svētdiena Sv Sv_pirmdiena P P_otrdiena O O_trešdiena T T_ceturtdiena C C_piektdiena Pk Pk_sestdiena S S'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "dažas sekundes", "44 seconds = seconds");
<ide> exports["lang:lv"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dienas", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mēnesi", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mēnesi", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mēnesi", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mēnesi", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mēneši", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mēneši", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mēneši", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mēnesi", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mēneši", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mēneši", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "gadu", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "gadu", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 gadi", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "gadu", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 gadi", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "dažas sekundes vēlāk", "prefix");
<ide> test.equal(moment(0).from(30000), "dažas sekundes agrāk", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "dažas sekundes agrāk", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "dažas sekundes vēlāk", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 dienas vēlāk", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:lv"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:lv"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/mk.js
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, H:mm:ss', 'недела, февруари 14-ти 2010, 15:25:50'],
<ide> ['ddd, hA', 'нед, 3PM'],
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-ви', '1-ви');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-ри', '2-ри');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3-ти', '3-ти');
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'јануари јан_февруари фев_март мар_април апр_мај мај_јуни јун_јули јул_август авг_септември сеп_октомври окт_ноември ное_декември дек'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'недела нед нe_понеделник пон пo_вторник вто вт_среда сре ср_четврток чет че_петок пет пе_сабота саб сa'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "неколку секунди", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "минута", "45 seconds = a minute");
<ide> exports["lang:mk"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 дена", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "месец", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "месец", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "месец", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "месец", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 месеци", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 месеци", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 месеци", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "месец", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 месеци", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 месеци", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "година", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "година", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 години", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "година", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 години", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "после неколку секунди", "prefix");
<ide> test.equal(moment(0).from(30000), "пред неколку секунди", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "пред неколку секунди", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "после неколку секунди", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "после 5 дена", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:mk"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:mk"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-ви', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-ви', "Jan 1 2012 should be week 1");
<ide><path>test/lang/ml.js
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(21);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, a h:mm:ss -നു', 'ഞായറാഴ്ച, 14 ഫെബ്രുവരി 2010, ഉച്ച കഴിഞ്ഞ് 3:25:50 -നു'],
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'ജനുവരി ജനു._ഫെബ്രുവരി ഫെബ്രു._മാർച്ച് മാർ._ഏപ്രിൽ ഏപ്രി._മേയ് മേയ്_ജൂൺ ജൂൺ_ജൂലൈ ജൂലൈ._ഓഗസ്റ്റ് ഓഗ._സെപ്റ്റംബർ സെപ്റ്റ._ഒക്ടോബർ ഒക്ടോ._നവംബർ നവം._ഡിസംബർ ഡിസം.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'ഞായറാഴ്ച ഞായർ ഞാ_തിങ്കളാഴ്ച തിങ്കൾ തി_ചൊവ്വാഴ്ച ചൊവ്വ ചൊ_ബുധനാഴ്ച ബുധൻ ബു_വ്യാഴാഴ്ച വ്യാഴം വ്യാ_വെള്ളിയാഴ്ച വെള്ളി വെ_ശനിയാഴ്ച ശനി ശ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "അൽപ നിമിഷങ്ങൾ", "44 seconds = a few seconds");
<ide> exports["lang:ml"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ദിവസം", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ഒരു മാസം", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ഒരു മാസം", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ഒരു മാസം", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ഒരു മാസം", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 മാസം", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 മാസം", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 മാസം", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ഒരു മാസം", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 മാസം", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 മാസം", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ഒരു വർഷം", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ഒരു വർഷം", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 വർഷം", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ഒരു വർഷം", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 വർഷം", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്", "prefix");
<ide> test.equal(moment(0).from(30000), "അൽപ നിമിഷങ്ങൾ മുൻപ്", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "അൽപ നിമിഷങ്ങൾ മുൻപ്", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്", "അൽപ നിമിഷങ്ങൾ കഴിഞ്ഞ്");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 ദിവസം കഴിഞ്ഞ്", "5 ദിവസം കഴിഞ്ഞ്");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(12);
<ide>
<ide> test.equal(moment([2011, 2, 23, 2, 30]).format('a'), "രാത്രി", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 9, 30]).format('a'), "രാവിലെ", "morning");
<ide> exports["lang:ml"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ml"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', "Jan 7 2012 should be week 1");
<ide><path>test/lang/mr.js
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'जानेवारी जाने._फेब्रुवारी फेब्रु._मार्च मार्च._एप्रिल एप्रि._मे मे._जून जून._जुलै जुलै._ऑगस्ट ऑग._सप्टेंबर सप्टें._ऑक्टोबर ऑक्टो._नोव्हेंबर नोव्हें._डिसेंबर डिसें.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(21);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, a h:mm:ss वाजता', 'रविवार, १४ फेब्रुवारी २०१०, दुपारी ३:२५:५० वाजता'],
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२');
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'जानेवारी जाने._फेब्रुवारी फेब्रु._मार्च मार्च._एप्रिल एप्रि._मे मे._जून जून._जुलै जुलै._ऑगस्ट ऑग._सप्टेंबर सप्टें._ऑक्टोबर ऑक्टो._नोव्हेंबर नोव्हें._डिसेंबर डिसें.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'रविवार रवि र_सोमवार सोम सो_मंगळवार मंगळ मं_बुधवार बुध बु_गुरूवार गुरू गु_शुक्रवार शुक्र शु_शनिवार शनि श'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "सेकंद", "44 seconds = a few seconds");
<ide> exports["lang:mr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "२५ दिवस", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ d: 26 }), true), "एक महिना", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ d: 30 }), true), "एक महिना", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({ d: 45 }), true), "एक महिना", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({ d: 43 }), true), "एक महिना", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ d: 46 }), true), "२ महिने", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ d: 74 }), true), "२ महिने", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ d: 76 }), true), "३ महिने", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ M: 1 }), true), "एक महिना", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ M: 5 }), true), "५ महिने", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({ d: 344 }), true), "११ महिने", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "एक वर्ष", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "एक वर्ष", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "२ वर्षे", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "एक वर्ष", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({ y: 5 }), true), "५ वर्षे", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "सेकंद नंतर", "prefix");
<ide> test.equal(moment(0).from(30000), "सेकंद पूर्वी", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "सेकंद पूर्वी", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({ s: 30 }).fromNow(), "सेकंद नंतर", "सेकंद नंतर");
<ide> test.equal(moment().add({ d: 5 }).fromNow(), "५ दिवस नंतर", "५ दिवस नंतर");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(12);
<ide>
<ide> test.equal(moment([2011, 2, 23, 2, 30]).format('a'), "रात्री", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 9, 30]).format('a'), "सकाळी", "morning");
<ide> exports["lang:mr"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:mr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '१ ०१ १', "Jan 7 2012 should be week 1");
<ide><path>test/lang/ms-my.js
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split("_");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Ahad, Februari 14 2010, 3:25:50 petang'],
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'Januari Jan_Februari Feb_Mac Mac_April Apr_Mei Mei_Jun Jun_Julai Jul_Ogos Ogs_September Sep_Oktober Okt_November Nov_Disember Dis'.split("_");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'Ahad Ahd Ah_Isnin Isn Is_Selasa Sel Sl_Rabu Rab Rb_Khamis Kha Km_Jumaat Jum Jm_Sabtu Sab Sb'.split("_");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:ms-my"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 hari", "25 hari = 25 hari");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "sebulan", "26 hari = sebulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "sebulan", "30 hari = sebulan");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "sebulan", "45 hari = sebulan");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "sebulan", "45 hari = sebulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 bulan", "46 hari = 2 bulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 bulan", "75 hari = 2 bulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 bulan", "76 hari = 3 bulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "sebulan", "1 bulan = sebulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 bulan", "5 bulan = 5 bulan");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 bulan", "344 hari = 11 bulan");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "setahun", "345 hari = setahun");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "setahun", "547 hari = setahun");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 tahun", "548 hari = 2 tahun");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "setahun", "1 tahun = setahun");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 tahun", "5 tahun = 5 tahun");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "dalam beberapa saat", "prefix");
<ide> test.equal(moment(0).from(30000), "beberapa saat yang lepas", "suffix");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "beberapa saat yang lepas", "waktu sekarang dari sekarang sepatutnya menunjukkan sebagai telah lepas");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "dalam beberapa saat", "dalam beberapa saat");
<ide> test.equal(moment().add({d: 5}).fromNow(), "dalam 5 hari", "dalam 5 hari");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ms-my"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 sepatutnya minggu 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 2, "Jan 7 2012 sepatutnya minggu 2");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 53, "Dec 31 2006 sepatutnya minggu 53");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 30]).week(), 52, "Dec 30 2007 sepatutnya minggu 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 52, "Dec 29 2002 sepatutnya minggu 52");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 52, "Dec 28 2008 sepatutnya minggu 52");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 52, "Dec 27 2009 sepatutnya minggu 52");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 52, "Dec 26 2010 sepatutnya minggu 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 sepatutnya minggu 1");
<ide> exports["lang:ms-my"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 sepatutnya minggu 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '2 02 2', "Jan 7 2012 sepatutnya minggu 2");
<ide><path>test/lang/nb.js
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januar jan_februar feb_mars mars_april april_mai mai_juni juni_juli juli_august aug_september sep_oktober okt_november nov_desember des'.split("_"),
<ide> i;
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'søndag, februar 14. 2010, 3:25:50 pm'],
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'januar jan._februar feb._mars mars_april april_mai mai_juni juni_juli juli_august aug._september sep._oktober okt._november nov._desember des.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'søndag sø. sø_mandag ma. ma_tirsdag ti. ti_onsdag on. on_torsdag to. to_fredag fr. fr_lørdag lø. lø'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "noen sekunder", "44 sekunder = a few seconds");
<ide> exports["lang:nb"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dager", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "en måned", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "en måned", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "en måned", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "en måned", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 måneder", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 måneder", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 måneder", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "en måned", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 måneder", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 måneder", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ett år", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ett år", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 år", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ett år", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 år", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "om noen sekunder", "prefix");
<ide> test.equal(moment(0).from(30000), "for noen sekunder siden", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "for noen sekunder siden", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "om noen sekunder", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "om 5 dager", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:nb"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:nb"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/ne.js
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'जनवरी जन._फेब्रुवरी फेब्रु._मार्च मार्च_अप्रिल अप्रि._मई मई_जुन जुन_जुलाई जुलाई._अगष्ट अग._सेप्टेम्बर सेप्ट._अक्टोबर अक्टो._नोभेम्बर नोभे._डिसेम्बर डिसे.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(21);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, aको h:mm:ss बजे', 'आइतबार, १४ फेब्रुवरी २०१०, बेलुकाको ३:२५:५० बजे'],
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '१', '१');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '२', '२');
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'जनवरी जन._फेब्रुवरी फेब्रु._मार्च मार्च_अप्रिल अप्रि._मई मई_जुन जुन_जुलाई जुलाई._अगष्ट अग._सेप्टेम्बर सेप्ट._अक्टोबर अक्टो._नोभेम्बर नोभे._डिसेम्बर डिसे.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'आइतबार आइत. आइ._सोमबार सोम. सो._मङ्गलबार मङ्गल. मङ्_बुधबार बुध. बु._बिहिबार बिहि. बि._शुक्रबार शुक्र. शु._शनिबार शनि. श.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "केही समय", "44 seconds = a few seconds");
<ide> exports["lang:ne"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "२५ दिन", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "एक महिना", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "एक महिना", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "एक महिना", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "एक महिना", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "२ महिना", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "२ महिना", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "३ महिना", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "एक महिना", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "५ महिना", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "११ महिना", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "एक बर्ष", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "एक बर्ष", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "२ बर्ष", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "एक बर्ष", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "५ बर्ष", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "केही समयमा", "prefix");
<ide> test.equal(moment(0).from(30000), "केही समय अगाडी", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "केही समय अगाडी", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "केही समयमा", "केही समयमा");
<ide> test.equal(moment().add({d: 5}).fromNow(), "५ दिनमा", "५ दिनमा");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(12);
<ide>
<ide> test.equal(moment([2011, 2, 23, 2, 30]).format('a'), "राती", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 9, 30]).format('a'), "बिहान", "morning");
<ide> exports["lang:ne"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ne"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '१ ०१ १', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '१ ०१ १', "Jan 1 2012 should be week 1");
<ide><path>test/lang/nl.js
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januari jan._februari feb._maart mrt._april apr._mei mei._juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, HH:mm:ss', 'zondag, februari 14de 2010, 15:25:50'],
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1ste', '1ste');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2de', '2de');
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'januari jan._februari feb._maart mrt._april apr._mei mei_juni jun._juli jul._augustus aug._september sep._oktober okt._november nov._december dec.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'zondag zo. Zo_maandag ma. Ma_dinsdag di. Di_woensdag wo. Wo_donderdag do. Do_vrijdag vr. Vr_zaterdag za. Za'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "een paar seconden", "44 seconds = a few seconds");
<ide> exports["lang:nl"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dagen", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "één maand", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "één maand", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "één maand", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "één maand", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 maanden", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 maanden", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 maanden", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "één maand", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 maanden", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 maanden", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "één jaar", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "één jaar", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 jaar", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "één jaar", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 jaar", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "over een paar seconden", "prefix");
<ide> test.equal(moment(0).from(30000), "een paar seconden geleden", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "een paar seconden geleden", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "over een paar seconden", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "over 5 dagen", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "month abbreviation" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment([2012, 5, 23]).format('D-MMM-YYYY'), '23-jun-2012', 'format month abbreviation surrounded by dashes should not include a dot');
<ide> test.equal(moment([2012, 5, 23]).format('D MMM YYYY'), '23 jun. 2012', 'format month abbreviation not surrounded by dashes should include a dot');
<ide> exports["lang:nl"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:nl"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52ste', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1ste', "Jan 2 2012 should be week 1");
<ide><path>test/lang/nn.js
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'sundag, februar 14. 2010, 3:25:50 pm'],
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'januar jan_februar feb_mars mar_april apr_mai mai_juni jun_juli jul_august aug_september sep_oktober okt_november nov_desember des'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'sundag sun su_måndag mån må_tysdag tys ty_onsdag ons on_torsdag tor to_fredag fre fr_laurdag lau lø'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "nokre sekund", "44 sekunder = a few seconds");
<ide> exports["lang:nn"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dagar", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ein månad", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ein månad", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ein månad", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ein månad", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 månader", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 månader", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 månader", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ein månad", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 månader", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 månader", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "eit år", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "eit år", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 år", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "eit år", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 år", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "om nokre sekund", "prefix");
<ide> test.equal(moment(0).from(30000), "for nokre sekund sidan", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "for nokre sekund sidan", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "om nokre sekund", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "om 5 dagar", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:nn"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:nn"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/pl.js
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'niedziela, luty 14. 2010, 3:25:50 pm'],
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'styczeń sty_luty lut_marzec mar_kwiecień kwi_maj maj_czerwiec cze_lipiec lip_sierpień sie_wrzesień wrz_październik paź_listopad lis_grudzień gru'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'niedziela nie N_poniedziałek pon Pn_wtorek wt Wt_środa śr Śr_czwartek czw Cz_piątek pt Pt_sobota sb So'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(34);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "kilka sekund", "44 seconds = a few seconds");
<ide> exports["lang:pl"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dni", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "miesiąc", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "miesiąc", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "miesiąc", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "miesiąc", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 miesiące", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 miesiące", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 miesiące", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "miesiąc", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 miesięcy", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 miesięcy", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "rok", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "rok", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 lata", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "rok", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 lat", "5 years = 5 years");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za kilka sekund", "prefix");
<ide> test.equal(moment(0).from(30000), "kilka sekund temu", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "kilka sekund temu", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(3);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za kilka sekund", "in a few seconds");
<ide> test.equal(moment().add({h: 1}).fromNow(), "za godzinę", "in an hour");
<ide> test.equal(moment().add({d: 5}).fromNow(), "za 5 dni", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:pl"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:pl"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/pt-br.js
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split("_"), i;
<ide>
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, fevereiro 14º 2010, 3:25:50 pm'],
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'domingo dom_segunda-feira seg_terça-feira ter_quarta-feira qua_quinta-feira qui_sexta-feira sex_sábado sáb'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "segundos", "44 seconds = seconds");
<ide> exports["lang:pt-br"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dias", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "um mês", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "um mês", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "um mês", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "um mês", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meses", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meses", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 meses", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "um mês", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 meses", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 meses", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "um ano", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "um ano", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 anos", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "um ano", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 anos", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "em segundos", "prefix");
<ide> test.equal(moment(0).from(30000), "segundos atrás", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "em segundos", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "em 5 dias", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:pt-br"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:pt-br"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1º', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1º', "Jan 7 2012 should be week 1");
<ide><path>test/lang/pt.js
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Janeiro Jan_Fevereiro Fev_Março Mar_Abril Abr_Maio Mai_Junho Jun_Julho Jul_Agosto Ago_Setembro Set_Outubro Out_Novembro Nov_Dezembro Dez'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'domingo, fevereiro 14º 2010, 3:25:50 pm'],
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1º', '1º');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2º', '2º');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3º', '3º');
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'janeiro jan_fevereiro fev_março mar_abril abr_maio mai_junho jun_julho jul_agosto ago_setembro set_outubro out_novembro nov_dezembro dez'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'domingo dom dom_segunda-feira seg 2ª_terça-feira ter 3ª_quarta-feira qua 4ª_quinta-feira qui 5ª_sexta-feira sex 6ª_sábado sáb sáb'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "segundos", "44 seconds = seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "um minuto", "45 seconds = a minute");
<ide> exports["lang:pt"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dias", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "um mês", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "um mês", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "um mês", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "um mês", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meses", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meses", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 meses", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "um mês", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 meses", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 meses", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "um ano", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "um ano", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 anos", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "um ano", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 anos", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "em segundos", "prefix");
<ide> test.equal(moment(0).from(30000), "há segundos", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "em segundos", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "em 5 dias", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:pt"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:pt"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52º', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1º', "Jan 2 2012 should be week 1");
<ide><path>test/lang/ro.js
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss A', 'duminică, februarie 14 2010, 3:25:50 PM'],
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'ianuarie ian._februarie febr._martie mart._aprilie apr._mai mai_iunie iun._iulie iul._august aug._septembrie sept._octombrie oct._noiembrie nov._decembrie dec.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'duminică Dum Du_luni Lun Lu_marți Mar Ma_miercuri Mie Mi_joi Joi Jo_vineri Vin Vi_sâmbătă Sâm Sâ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(38);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "câteva secunde", "44 seconds = a few seconds");
<ide> exports["lang:ro"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 de zile", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "o lună", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "o lună", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "o lună", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "o lună", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 luni", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 luni", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 luni", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "o lună", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 luni", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 luni", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "un an", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "un an", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ani", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "un an", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ani", "5 years = 5 years");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "peste câteva secunde", "prefix");
<ide> test.equal(moment(0).from(30000), "câteva secunde în urmă", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "câteva secunde în urmă", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "peste câteva secunde", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "peste 5 zile", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:ro"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ro"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide><path>test/lang/ru.js
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, HH:mm:ss', 'воскресенье, 14-го февраля 2010, 15:25:50'],
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format meridiem" : function (test) {
<del> test.expect(8);
<ide>
<ide> test.equal(moment([2012, 11, 28, 0, 0]).format("A"), "ночи", "night");
<ide> test.equal(moment([2012, 11, 28, 3, 59]).format("A"), "ночи", "night");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-й', '1-й');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-й', '2-й');
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format month case" : function (test) {
<del> test.expect(24);
<ide>
<ide> var months = {
<ide> 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format month short case" : function (test) {
<del> test.expect(24);
<ide>
<ide> var monthsShort = {
<ide> 'nominative': 'янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format month case with escaped symbols" : function (test) {
<del> test.expect(48);
<ide>
<ide> var months = {
<ide> 'nominative': 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format month short case with escaped symbols" : function (test) {
<del> test.expect(48);
<ide>
<ide> var monthsShort = {
<ide> 'nominative': 'янв_фев_мар_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'воскресенье вс вс_понедельник пн пн_вторник вт вт_среда ср ср_четверг чт чт_пятница пт пт_суббота сб сб'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(33);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "несколько секунд", "44 seconds = seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "минута", "45 seconds = a minute");
<ide> exports["lang:ru"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 дней", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "месяц", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "месяц", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "месяц", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "месяц", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 месяца", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 месяца", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 месяца", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "месяц", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 месяцев", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 месяцев", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "год", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "год", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 года", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "год", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 лет", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "через несколько секунд", "prefix");
<ide> test.equal(moment(0).from(30000), "несколько секунд назад", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(4);
<ide> test.equal(moment().add({s: 30}).fromNow(), "через несколько секунд", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "через 5 дней", "in 5 days");
<ide> test.equal(moment().add({m: 31}).fromNow(), "через 31 минуту", "in 31 minutes = in 31 minutes");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> function makeFormat(d) {
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ru"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ru"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-я', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-я', "Jan 1 2012 should be week 1");
<ide><path>test/lang/sk.js
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'január jan._február feb._marec mar._apríl apr._máj máj_jún jún._júl júl._august aug._september sep._október okt._november nov._december dec.'.split("_"), i;
<ide> function equalTest(input, mmm, monthIndex) {
<ide> test.equal(moment(input, mmm).month(), monthIndex, input + ' should be month ' + (monthIndex + 1));
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss', 'nedeľa, február 14. 2010, 3:25:50'],
<ide> ['ddd, h', 'ne, 3'],
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'január jan_február feb_marec mar_apríl apr_máj máj_jún jún_júl júl_august aug_september sep_október okt_november nov_december dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'nedeľa ne ne_pondelok po po_utorok ut ut_streda st st_štvrtok št št_piatok pi pi_sobota so so'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "pár sekúnd", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "minúta", "45 seconds = a minute");
<ide> exports["lang:sk"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dní", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mesiac", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mesiac", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mesiac", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mesiac", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 mesiace", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 mesiace", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mesiace", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mesiac", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mesiacov", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mesiacov", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "rok", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "rok", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 roky", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "rok", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 rokov", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za pár sekúnd", "prefix");
<ide> test.equal(moment(0).from(30000), "pred pár sekundami", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "pred pár sekundami", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow (future)" : function (test) {
<del> test.expect(16);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za pár sekúnd", "in a few seconds");
<ide> test.equal(moment().add({m: 1}).fromNow(), "za minútu", "in a minute");
<ide> test.equal(moment().add({m: 3}).fromNow(), "za 3 minúty", "in 3 minutes");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "fromNow (past)" : function (test) {
<del> test.expect(16);
<ide> test.equal(moment().subtract({s: 30}).fromNow(), "pred pár sekundami", "a few seconds ago");
<ide> test.equal(moment().subtract({m: 1}).fromNow(), "pred minútou", "a minute ago");
<ide> test.equal(moment().subtract({m: 3}).fromNow(), "pred 3 minútami", "3 minutes ago");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, nextDay;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m, lastDay;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "humanize duration" : function (test) {
<del> test.expect(4);
<ide> test.equal(moment.duration(1, "minutes").humanize(), "minúta", "a minute (future)");
<ide> test.equal(moment.duration(1, "minutes").humanize(true), "za minútu", "in a minute");
<ide> test.equal(moment.duration(-1, "minutes").humanize(), "minúta", "a minute (past)");
<ide> exports["lang:sk"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:sk"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/sl.js
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januar jan._februar feb._marec mar._april apr._maj maj_junij jun._julij jul._avgust avg._september sep._oktober okt._november nov._december dec.'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'ned., 3PM'],
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januar jan._februar feb._marec mar._april apr._maj maj._junij jun._julij jul._avgust avg._september sep._oktober okt._november nov._december dec.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'nedelja ned. ne_ponedeljek pon. po_torek tor. to_sreda sre. sr_četrtek čet. če_petek pet. pe_sobota sob. so'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "nekaj sekund", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "ena minuta", "45 seconds = a minute");
<ide> exports["lang:sl"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dni", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "en mesec", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "en mesec", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "en mesec", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "en mesec", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meseca", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meseca", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 mesece", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "en mesec", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 mesecev", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 mesecev", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "eno leto", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "eno leto", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 leti", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "eno leto", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 let", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "čez nekaj sekund", "prefix");
<ide> test.equal(moment(0).from(30000), "nekaj sekund nazaj", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "nekaj sekund nazaj", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "čez nekaj sekund", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "čez 5 dni", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:sl"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:sl"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/sq.js
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.split("_");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, HH:mm:ss', 'E Diel, Shkurt 14. 2010, 15:25:50'],
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment([2011, 2, 23, 0, 0]).format('A'), "PD", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 12, 0]).format('A'), "MD", "noon");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'Janar Jan_Shkurt Shk_Mars Mar_Prill Pri_Maj Maj_Qershor Qer_Korrik Kor_Gusht Gus_Shtator Sht_Tetor Tet_Nëntor Nën_Dhjetor Dhj'.split("_");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'E Diel Die D_E Hënë Hën H_E Martë Mar Ma_E Mërkurë Mër Më_E Enjte Enj E_E Premte Pre P_E Shtunë Sht Sh'.split("_");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:sq"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ditë", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "një muaj", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "një muaj", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "një muaj", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "një muaj", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 muaj", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 muaj", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 muaj", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "një muaj", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 muaj", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 muaj", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "një vit", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "një vit", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 vite", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "një vit", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 vite", "5 years = 5 years");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "në disa sekonda", "prefix");
<ide> test.equal(moment(0).from(30000), "disa sekonda më parë", "suffix");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "disa sekonda më parë", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "në disa sekonda", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "në 5 ditë", "in 5 days");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:sq"] = {
<ide> // Monday is the first day of the week.
<ide> // The week that contains Jan 4th is the first week of the year.
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:sq"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52.', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1.', "Jan 2 2012 should be week 1");
<ide><path>test/lang/sr-cyrl.js
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.split("_"),
<ide> i;
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'недеља, 14. фебруар 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'нед., 3PM'],
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'јануар јан._фебруар феб._март мар._април апр._мај мај_јун јун_јул јул_август авг._септембар сеп._октобар окт._новембар нов._децембар дец.'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'недеља нед. не_понедељак пон. по_уторак уто. ут_среда сре. ср_четвртак чет. че_петак пет. пе_субота суб. су'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "неколико секунди", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "један минут", "45 seconds = a minute");
<ide> exports["lang:sr-cyrl"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 дана", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "месец", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "месец", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "месец", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "месец", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 месеца", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 месеца", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 месеца", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "месец", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 месеци", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 месеци", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "годину", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "годину", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 године", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "годину", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 година", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "за неколико секунди", "prefix");
<ide> test.equal(moment(0).from(30000), "пре неколико секунди", "prefix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "пре неколико секунди", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "за неколико секунди", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "за 5 дана", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:sr-cyrl"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:sr-cyrl"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/sr.js
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split("_"),
<ide> i;
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'nedelja, 14. februar 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'ned., 3PM'],
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1.', '1.');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2.', '2.');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3.', '3.');
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januar jan._februar feb._mart mar._april apr._maj maj_jun jun_jul jul_avgust avg._septembar sep._oktobar okt._novembar nov._decembar dec.'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'nedelja ned. ne_ponedeljak pon. po_utorak uto. ut_sreda sre. sr_četvrtak čet. če_petak pet. pe_subota sub. su'.split("_"),
<ide> i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "nekoliko sekundi", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "jedan minut", "45 seconds = a minute");
<ide> exports["lang:sr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dana", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "mesec", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "mesec", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "mesec", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "mesec", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 meseca", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 meseca", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 meseca", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "mesec", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 meseci", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 meseci", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "godinu", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "godinu", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 godine", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "godinu", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 godina", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "za nekoliko sekundi", "prefix");
<ide> test.equal(moment(0).from(30000), "pre nekoliko sekundi", "prefix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "pre nekoliko sekundi", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "za nekoliko sekundi", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "za 5 dana", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:sr"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:sr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1.', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1.', "Jan 1 2012 should be week 1");
<ide><path>test/lang/sv.js
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'söndag, februari 14e 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'sön, 3PM'],
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1a', '1a');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2a', '2a');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3e', '3e');
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'januari jan_februari feb_mars mar_april apr_maj maj_juni jun_juli jul_augusti aug_september sep_oktober okt_november nov_december dec'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'söndag sön sö_måndag mån må_tisdag tis ti_onsdag ons on_torsdag tor to_fredag fre fr_lördag lör lö'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "några sekunder", "44 sekunder = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "en minut", "45 seconds = a minute");
<ide> exports["lang:sv"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 dagar", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "en månad", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "en månad", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "en månad", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "en månad", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 månader", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 månader", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 månader", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "en månad", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 månader", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 månader", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ett år", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ett år", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 år", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ett år", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 år", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "om några sekunder", "prefix");
<ide> test.equal(moment(0).from(30000), "för några sekunder sedan", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "för några sekunder sedan", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "om några sekunder", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "om 5 dagar", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:sv"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:sv"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52a', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1a', "Jan 2 2012 should be week 1");
<ide><path>test/lang/ta.js
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'ஜனவரி ஜனவரி_பிப்ரவரி பிப்ரவரி_மார்ச் மார்ச்_ஏப்ரல் ஏப்ரல்_மே மே_ஜூன் ஜூன்_ஜூலை ஜூலை_ஆகஸ்ட் ஆகஸ்ட்_செப்டெம்பர் செப்டெம்பர்_அக்டோபர் அக்டோபர்_நவம்பர் நவம்பர்_டிசம்பர் டிசம்பர்'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'ஞாயிற்றுக்கிழமை, பிப்ரவரி 14வது 2010, 3:25:50 எற்பாடு'],
<ide> ['ddd, hA', 'ஞாயிறு, 3 எற்பாடு'],
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1வது', '1வது');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2வது', '2வது');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3வது', '3வது');
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'ஜனவரி ஜனவரி_பிப்ரவரி பிப்ரவரி_மார்ச் மார்ச்_ஏப்ரல் ஏப்ரல்_மே மே_ஜூன் ஜூன்_ஜூலை ஜூலை_ஆகஸ்ட் ஆகஸ்ட்_செப்டெம்பர் செப்டெம்பர்_அக்டோபர் அக்டோபர்_நவம்பர் நவம்பர்_டிசம்பர் டிசம்பர்'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'ஞாயிற்றுக்கிழமை ஞாயிறு ஞா_திங்கட்கிழமை திங்கள் தி_செவ்வாய்கிழமை செவ்வாய் செ_புதன்கிழமை புதன் பு_வியாழக்கிழமை வியாழன் வி_வெள்ளிக்கிழமை வெள்ளி வெ_சனிக்கிழமை சனி ச'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ஒரு சில விநாடிகள்", "44 விநாடிகள் = ஒரு சில விநாடிகள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "ஒரு நிமிடம்", "45 விநாடிகள் = ஒரு நிமிடம்");
<ide> exports["lang:ta"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 நாட்கள்", "25 நாட்கள் = 25 நாட்கள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ஒரு மாதம்", "26 நாட்கள் = ஒரு மாதம்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ஒரு மாதம்", "30 நாட்கள் = ஒரு மாதம்");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ஒரு மாதம்", "45 நாட்கள் = ஒரு மாதம்");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ஒரு மாதம்", "45 நாட்கள் = ஒரு மாதம்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 மாதங்கள்", "46 நாட்கள் = 2 மாதங்கள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 மாதங்கள்", "75 நாட்கள் = 2 மாதங்கள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 மாதங்கள்", "76 நாட்கள் = 3 மாதங்கள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ஒரு மாதம்", "1 மாதம் = ஒரு மாதம்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 மாதங்கள்", "5 மாதங்கள் = 5 மாதங்கள்");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 மாதங்கள்", "344 நாட்கள் = 11 மாதங்கள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ஒரு வருடம்", "345 நாட்கள் = ஒரு வருடம்");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ஒரு வருடம்", "547 நாட்கள் = ஒரு வருடம்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ஆண்டுகள்", "548 நாட்கள் = 2 ஆண்டுகள்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ஒரு வருடம்", "1 வருடம் = ஒரு வருடம்");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ஆண்டுகள்", "5 ஆண்டுகள் = 5 ஆண்டுகள்");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "ஒரு சில விநாடிகள் இல்", "prefix");
<ide> test.equal(moment(0).from(30000), "ஒரு சில விநாடிகள் முன்", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "ஒரு சில விநாடிகள் முன்", "இப்போது இருந்து கடந்த காலத்தில் காட்ட வேண்டும்");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "ஒரு சில விநாடிகள் இல்", "ஒரு சில விநாடிகள் இல்");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 நாட்கள் இல்", "5 நாட்கள் இல்");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:ta"] = {
<ide>
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:ta"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:ta"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2011, 2, 23, 2, 30]).format('a'), " வைகறை", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 9, 30]).format('a'), " காலை", "morning");
<ide><path>test/lang/th.js
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'มกราคม มกรา_กุมภาพันธ์ กุมภา_มีนาคม มีนา_เมษายน เมษา_พฤษภาคม พฤษภา_มิถุนายน มิถุนา_กรกฎาคม กรกฎา_สิงหาคม สิงหา_กันยายน กันยา_ตุลาคม ตุลา_พฤศจิกายน พฤศจิกา_ธันวาคม ธันวา'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, h:mm:ss a', 'อาทิตย์, 14 กุมภาพันธ์ 2010, 3:25:50 หลังเที่ยง'],
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'มกราคม มกรา_กุมภาพันธ์ กุมภา_มีนาคม มีนา_เมษายน เมษา_พฤษภาคม พฤษภา_มิถุนายน มิถุนา_กรกฎาคม กรกฎา_สิงหาคม สิงหา_กันยายน กันยา_ตุลาคม ตุลา_พฤศจิกายน พฤศจิกา_ธันวาคม ธันวา'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'อาทิตย์ อาทิตย์ อา._จันทร์ จันทร์ จ._อังคาร อังคาร อ._พุธ พุธ พ._พฤหัสบดี พฤหัส พฤ._ศุกร์ ศุกร์ ศ._เสาร์ เสาร์ ส.'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ไม่กี่วินาที", "44 seconds = a few seconds");
<ide> exports["lang:th"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 วัน", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "1 เดือน", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "1 เดือน", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "1 เดือน", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "1 เดือน", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 เดือน", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 เดือน", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 เดือน", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "1 เดือน", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 เดือน", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 เดือน", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "1 ปี", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "1 ปี", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ปี", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "1 ปี", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ปี", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "อีก ไม่กี่วินาที", "prefix");
<ide> test.equal(moment(0).from(30000), "ไม่กี่วินาทีที่แล้ว", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "ไม่กี่วินาทีที่แล้ว", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "อีก ไม่กี่วินาที", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "อีก 5 วัน", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:th"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:th"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1', "Jan 7 2012 should be week 1");
<ide><path>test/lang/tl-ph.js
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.split("_"),
<ide> i;
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'Linggo, Pebrero 14 2010, 3:25:50 pm'],
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'Enero Ene_Pebrero Peb_Marso Mar_Abril Abr_Mayo May_Hunyo Hun_Hulyo Hul_Agosto Ago_Setyembre Set_Oktubre Okt_Nobyembre Nob_Disyembre Dis'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Linggo Lin Li_Lunes Lun Lu_Martes Mar Ma_Miyerkules Miy Mi_Huwebes Huw Hu_Biyernes Biy Bi_Sabado Sab Sab'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ilang segundo", "44 seconds = a few seconds");
<ide> exports["lang:tl-ph"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 araw", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "isang buwan", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "isang buwan", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "isang buwan", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "isang buwan", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 buwan", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 buwan", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 buwan", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "isang buwan", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 buwan", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 buwan", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "isang taon", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "isang taon", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 taon", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "isang taon", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 taon", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "sa loob ng ilang segundo", "prefix");
<ide> test.equal(moment(0).from(30000), "ilang segundo ang nakalipas", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "sa loob ng ilang segundo", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "sa loob ng 5 araw", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "same day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "same next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "same last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "same all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:tl-ph"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:tl-ph"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', "Jan 2 2012 should be week 1");
<ide><path>test/lang/tr.js
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:tr"] = {
<ide> dt = moment(new Date(2010, 1, 14, 15, 25, 50, 125)),
<ide> DDDoDt,
<ide> i;
<del> test.expect(a.length + DDDo.length);
<ide>
<ide> for (i = 0; i < a.length; i++) {
<ide> test.equal(dt.format(a[i][0]), a[i][1], a[i][0] + ' ---> ' + a[i][1]);
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1\'inci', '1st');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2\'nci', '2nd');
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'Ocak Oca_Şubat Şub_Mart Mar_Nisan Nis_Mayıs May_Haziran Haz_Temmuz Tem_Ağustos Ağu_Eylül Eyl_Ekim Eki_Kasım Kas_Aralık Ara'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'Pazar Paz Pz_Pazartesi Pts Pt_Salı Sal Sa_Çarşamba Çar Ça_Perşembe Per Pe_Cuma Cum Cu_Cumartesi Cts Ct'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "birkaç saniye", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "bir dakika", "45 seconds = a minute");
<ide> exports["lang:tr"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 gün", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "bir ay", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "bir ay", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "bir ay", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "bir ay", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 ay", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 ay", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 ay", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "bir ay", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 ay", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 ay", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "bir yıl", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "bir yıl", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 yıl", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "bir yıl", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 yıl", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "birkaç saniye sonra", "prefix");
<ide> test.equal(moment(0).from(30000), "birkaç saniye önce", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "birkaç saniye önce", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "birkaç saniye sonra", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 gün sonra", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:tr"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:tr"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), "1 01 1'inci", "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), "1 01 1'inci", "Jan 1 2012 should be week 1");
<ide><path>test/lang/tzm-latn.js
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'asamas, brˤayrˤ 14 2010, 3:25:50 pm'],
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = 'innayr innayr_brˤayrˤ brˤayrˤ_marˤsˤ marˤsˤ_ibrir ibrir_mayyw mayyw_ywnyw ywnyw_ywlywz ywlywz_ɣwšt ɣwšt_šwtanbir šwtanbir_ktˤwbrˤ ktˤwbrˤ_nwwanbir nwwanbir_dwjnbir dwjnbir'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = 'asamas asamas asamas_aynas aynas aynas_asinas asinas asinas_akras akras akras_akwas akwas akwas_asimwas asimwas asimwas_asiḍyas asiḍyas asiḍyas'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "imik", "44 seconds = a few seconds");
<ide> exports["lang:tzm-latn"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ossan", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ayowr", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ayowr", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ayowr", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ayowr", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 iyyirn", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 iyyirn", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 iyyirn", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ayowr", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 iyyirn", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 iyyirn", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "asgas", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "asgas", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 isgasn", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "asgas", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 isgasn", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "dadkh s yan imik", "prefix");
<ide> test.equal(moment(0).from(30000), "yan imik", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "yan imik", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "dadkh s yan imik", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "dadkh s yan 5 ossan", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:tzm-latn"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).week(), 1, "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).week(), 1, "Jan 6 2012 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2006, 11, 30]).week(), 1, "Dec 30 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 5]).week(), 1, "Jan 5 2007 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 1, "Dec 29 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 28]).week(), 1, "Dec 28 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 27]).week(), 1, "Dec 27 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 11, 26]).week(), 1, "Dec 26 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> test.equal(moment([2011, 0, 7]).week(), 1, "Jan 7 2011 should be week 1");
<ide> exports["lang:tzm-latn"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', "Jan 6 2012 should be week 1");
<ide><path>test/lang/tzm.js
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'ⴰⵙⴰⵎⴰⵙ, ⴱⵕⴰⵢⵕ 14 2010, 3:25:50 pm'],
<ide> ['ddd, hA', 'ⴰⵙⴰⵎⴰⵙ, 3PM'],
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'ⵉⵏⵏⴰⵢⵔ ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ ⴷⵓⵊⵏⴱⵉⵔ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ ⴰⵙⵉⴹⵢⴰⵙ'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "ⵉⵎⵉⴽ", "44 seconds = a few seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "ⵎⵉⵏⵓⴺ", "45 seconds = a minute");
<ide> exports["lang:tzm"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 oⵙⵙⴰⵏ", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "ⴰⵢoⵓⵔ", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "ⴰⵢoⵓⵔ", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "ⴰⵢoⵓⵔ", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "ⴰⵢoⵓⵔ", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 ⵉⵢⵢⵉⵔⵏ", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 ⵉⵢⵢⵉⵔⵏ", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 ⵉⵢⵢⵉⵔⵏ", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "ⴰⵢoⵓⵔ", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 ⵉⵢⵢⵉⵔⵏ", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 ⵉⵢⵢⵉⵔⵏ", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "ⴰⵙⴳⴰⵙ", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "ⴰⵙⴳⴰⵙ", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 ⵉⵙⴳⴰⵙⵏ", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "ⴰⵙⴳⴰⵙ", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 ⵉⵙⴳⴰⵙⵏ", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ", "prefix");
<ide> test.equal(moment(0).from(30000), "ⵢⴰⵏ ⵉⵎⵉⴽ", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "ⵢⴰⵏ ⵉⵎⵉⴽ", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ ⵉⵎⵉⴽ", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ 5 oⵙⵙⴰⵏ", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:tzm"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).week(), 1, "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).week(), 1, "Jan 6 2012 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2006, 11, 30]).week(), 1, "Dec 30 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 5]).week(), 1, "Jan 5 2007 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 1, "Dec 29 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 28]).week(), 1, "Dec 28 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 27]).week(), 1, "Dec 27 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 11, 26]).week(), 1, "Dec 26 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> test.equal(moment([2011, 0, 7]).week(), 1, "Jan 7 2011 should be week 1");
<ide> exports["lang:tzm"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 31]).format('w ww wo'), '1 01 1', "Dec 31 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 6]).format('w ww wo'), '1 01 1', "Jan 6 2012 should be week 1");
<ide><path>test/lang/uk.js
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide> var tests = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> test.equal(moment(input, mmm).month(), i, input + ' should be month ' + (i + 1));
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(18);
<ide> var a = [
<ide> ['dddd, Do MMMM YYYY, HH:mm:ss', 'неділя, 14-го лютого 2010, 15:25:50'],
<ide> ['ddd, h A', 'нд, 3 дня'],
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format meridiem" : function (test) {
<del> test.expect(8);
<ide>
<ide> test.equal(moment([2012, 11, 28, 0, 0]).format("A"), "ночі", "night");
<ide> test.equal(moment([2012, 11, 28, 3, 59]).format("A"), "ночі", "night");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1-й', '1-й');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2-й', '2-й');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3-й', '3-й');
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'січень січ_лютий лют_березень бер_квітень квіт_травень трав_червень черв_липень лип_серпень серп_вересень вер_жовтень жовт_листопад лист_грудень груд'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format month case" : function (test) {
<del> test.expect(24);
<ide> var months = {
<ide> 'nominative': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_'),
<ide> 'accusative': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_')
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'неділя нд нд_понеділок пн пн_вівторок вт вт_середа ср ср_четвер чт чт_п’ятниця пт пт_субота сб сб'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(32);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "декілька секунд", "44 seconds = seconds");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "хвилина", "45 seconds = a minute");
<ide> exports["lang:uk"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 днів", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "місяць", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "місяць", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "місяць", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "місяць", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 місяці", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 місяці", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 місяці", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "місяць", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 місяців", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 місяців", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "рік", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "рік", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 роки", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "рік", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 років", "5 years = 5 years");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "за декілька секунд", "prefix");
<ide> test.equal(moment(0).from(30000), "декілька секунд тому", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "за декілька секунд", "in seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "за 5 днів", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(7);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide>
<ide> exports["lang:uk"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).week(), 1, "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:uk"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2011, 11, 26]).format('w ww wo'), '1 01 1-й', "Dec 26 2011 should be week 1");
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1-й', "Jan 1 2012 should be week 1");
<ide><path>test/lang/uz.js
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июнь_июль июль_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide> var a = [
<ide> ['dddd, Do-MMMM YYYY, h:mm:ss', 'Якшанба, 14-февраль 2010, 3:25:50'],
<ide> ['ddd, h:mm', 'Якш, 3:25'],
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> test.equal(moment([2011, 0, 3]).format('DDDo'), '3', '3');
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide> var expected = 'январь янв_февраль фев_март мар_апрель апр_май май_июнь июн_июль июл_август авг_сентябрь сен_октябрь окт_ноябрь ноя_декабрь дек'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, i, 1]).format('MMMM MMM'), expected[i], expected[i]);
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide> var expected = 'Якшанба Якш Як_Душанба Душ Ду_Сешанба Сеш Се_Чоршанба Чор Чо_Пайшанба Пай Па_Жума Жум Жу_Шанба Шан Ша'.split("_"), i;
<ide> for (i = 0; i < expected.length; i++) {
<ide> test.equal(moment([2011, 0, 2 + i]).format('dddd ddd dd'), expected[i], expected[i]);
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "фурсат", "44 секунд = фурсат");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 45}), true), "бир дакика", "45 секунд = бир дакика");
<ide> exports["lang:uz"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 кун", "25 кун = 25 кун");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "бир ой", "26 кун = бир ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "бир ой", "30 кун = бир ой");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "бир ой", "45 кун = бир ой");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "бир ой", "45 кун = бир ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 ой", "46 кун = 2 ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 ой", "75 кун = 2 ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 ой", "76 кун = 3 ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "бир ой", "бир ой = бир ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 ой", "5 ой = 5 ой");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 ой", "344 кун = 11 ой");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "бир йил", "345 кун = бир йил");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "бир йил", "547 кун = бир йил");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 йил", "548 кун = 2 йил");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "бир йил", "1 йил = бир йил");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 йил", "5 йил = 5 йил");
<ide> test.done();
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment(30000).from(0), "Якин фурсат ичида", "prefix");
<ide> test.equal(moment(0).from(30000), "Бир неча фурсат олдин", "suffix");
<ide> test.done();
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide> test.equal(moment().fromNow(), "Бир неча фурсат олдин", "now from now should display as in the past");
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide> test.equal(moment().add({s: 30}).fromNow(), "Якин фурсат ичида", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "Якин 5 кун ичида", "in 5 days");
<ide> test.done();
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:uz"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 2, "Jan 2 2012 should be week 1");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 1, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 53");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 1, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 52");
<ide> exports["lang:uz"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '2 02 2', "Jan 2 2012 should be week 1");
<ide><path>test/lang/vi.js
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var i,
<ide> tests = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split("_");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, h:mm:ss a', 'chủ nhật, tháng 2 14 2010, 3:25:50 pm'],
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "format ordinal" : function (test) {
<del> test.expect(31);
<ide>
<ide> test.equal(moment([2011, 0, 1]).format('DDDo'), '1', '1');
<ide> test.equal(moment([2011, 0, 2]).format('DDDo'), '2', '2');
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var i,
<ide> expected = 'tháng 1,Th01_tháng 2,Th02_tháng 3,Th03_tháng 4,Th04_tháng 5,Th05_tháng 6,Th06_tháng 7,Th07_tháng 8,Th08_tháng 9,Th09_tháng 10,Th10_tháng 11,Th11_tháng 12,Th12'.split("_");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var i,
<ide> expected = 'chủ nhật CN CN_thứ hai T2 T2_thứ ba T3 T3_thứ tư T4 T4_thứ năm T5 T5_thứ sáu T6 T6_thứ bảy T7 T7'.split("_");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide>
<ide> exports["lang:vi"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25 ngày", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "một tháng", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "một tháng", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "một tháng", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "một tháng", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2 tháng", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2 tháng", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3 tháng", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "một tháng", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5 tháng", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11 tháng", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "một năm", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "một năm", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2 năm", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "một năm", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5 năm", "5 years = 5 years");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "vài giây tới", "prefix");
<ide> test.equal(moment(0).from(30000), "vài giây trước", "suffix");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "vài giây trước", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "vài giây tới", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5 ngày tới", "in 5 days");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide>
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:vi"] = {
<ide> // The week that contains Jan 4th is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 1");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> test.equal(moment([2007, 0, 7]).week(), 1, "Jan 7 2007 should be week 1");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 31]).week(), 1, "Dec 31 2007 should be week 1");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 30]).week(), 1, "Dec 30 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 29]).week(), 1, "Dec 29 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 28]).week(), 53, "Dec 28 2009 should be week 53");
<ide> test.equal(moment([2010, 0, 1]).week(), 53, "Jan 1 2010 should be week 53");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2010, 11, 27]).week(), 52, "Dec 27 2010 should be week 52");
<ide> test.equal(moment([2011, 0, 1]).week(), 52, "Jan 1 2011 should be week 52");
<ide> exports["lang:vi"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday formatted" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52', "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).format('w ww wo'), '1 01 1', "Jan 2 2012 should be week 1");
<ide><path>test/lang/zh-cn.js
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_"), i;
<ide>
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'],
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_"), i;
<ide>
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = '星期日 周日 日_星期一 周一 一_星期二 周二 二_星期三 周三 三_星期四 周四 四_星期五 周五 五_星期六 周六 六'.split("_"), i;
<ide>
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "几秒", "44 seconds = a few seconds");
<ide> exports["lang:zh-cn"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25天", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "1个月", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "1个月", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "1个月", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "1个月", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2个月", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2个月", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3个月", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "1个月", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5个月", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11个月", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "1年", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "1年", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2年", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "1年", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5年", "5 years = 5 years");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "几秒内", "prefix");
<ide> test.equal(moment(0).from(30000), "几秒前", "suffix");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "几秒前", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "几秒内", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5天内", "in 5 days");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2011, 2, 23, 0, 0]).format('A'), "凌晨", "before dawn");
<ide> test.equal(moment([2011, 2, 23, 6, 0]).format('A'), "早上", "morning");
<ide> exports["lang:zh-cn"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(4);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 52, "Jan 1 2012 should be week 52");
<ide> test.equal(moment([2012, 0, 2]).week(), 1, "Jan 2 2012 should be week 52");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 52, "Dec 31 2006 should be week 52");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 52, "Dec 29 2002 should be week 52");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> test.equal(moment([2009, 0, 3]).week(), 1, "Jan 3 2009 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment([2010, 0, 2]).week(), 53, "Jan 2 2010 should be week 53");
<ide> test.equal(moment([2010, 0, 10]).week(), 1, "Jan 10 2010 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(3);
<ide>
<ide> test.equal(moment([2011, 0, 2]).week(), 52, "Jan 2 2011 should be week 52");
<ide> test.equal(moment([2011, 0, 8]).week(), 1, "Jan 8 2011 should be week 1");
<ide> exports["lang:zh-cn"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(3);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '52 52 52周', "Jan 1 2012 应该是第52周");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1周', "Jan 7 2012 应该是第 1周");
<ide><path>test/lang/zh-tw.js
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "parse" : function (test) {
<del> test.expect(96);
<ide>
<ide> var tests = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_"), i;
<ide> function equalTest(input, mmm, i) {
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "format" : function (test) {
<del> test.expect(22);
<ide>
<ide> var a = [
<ide> ['dddd, MMMM Do YYYY, a h:mm:ss', '星期日, 二月 14日 2010, 下午 3:25:50'],
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "format month" : function (test) {
<del> test.expect(12);
<ide>
<ide> var expected = '一月 1月_二月 2月_三月 3月_四月 4月_五月 5月_六月 6月_七月 7月_八月 8月_九月 9月_十月 10月_十一月 11月_十二月 12月'.split("_"), i;
<ide>
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "format week" : function (test) {
<del> test.expect(7);
<ide>
<ide> var expected = '星期日 週日 日_星期一 週一 一_星期二 週二 二_星期三 週三 三_星期四 週四 四_星期五 週五 五_星期六 週六 六'.split("_"), i;
<ide>
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "from" : function (test) {
<del> test.expect(30);
<ide>
<ide> var start = moment([2007, 1, 28]);
<ide> test.equal(start.from(moment([2007, 1, 28]).add({s: 44}), true), "幾秒", "44 seconds = a few seconds");
<ide> exports["lang:zh-tw"] = {
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 25}), true), "25天", "25 days = 25 days");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 26}), true), "一個月", "26 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 30}), true), "一個月", "30 days = a month");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 45}), true), "一個月", "45 days = a month");
<add> test.equal(start.from(moment([2007, 1, 28]).add({d: 43}), true), "一個月", "43 days = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 46}), true), "2個月", "46 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 74}), true), "2個月", "75 days = 2 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 76}), true), "3個月", "76 days = 3 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 1}), true), "一個月", "1 month = a month");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true), "5個月", "5 months = 5 months");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 344}), true), "11個月", "344 days = 11 months");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), "一年", "345 days = a year");
<del> test.equal(start.from(moment([2007, 1, 28]).add({d: 547}), true), "一年", "547 days = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), "2年", "548 days = 2 years");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true), "一年", "1 year = a year");
<ide> test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true), "5年", "5 years = 5 years");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "suffix" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment(30000).from(0), "幾秒內", "prefix");
<ide> test.equal(moment(0).from(30000), "幾秒前", "suffix");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "now from now" : function (test) {
<del> test.expect(1);
<ide>
<ide> test.equal(moment().fromNow(), "幾秒前", "now from now should display as in the past");
<ide>
<ide> test.done();
<ide> },
<ide>
<ide> "fromNow" : function (test) {
<del> test.expect(2);
<ide>
<ide> test.equal(moment().add({s: 30}).fromNow(), "幾秒內", "in a few seconds");
<ide> test.equal(moment().add({d: 5}).fromNow(), "5天內", "in 5 days");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "calendar day" : function (test) {
<del> test.expect(6);
<ide>
<ide> var a = moment().hours(2).minutes(0).seconds(0);
<ide>
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "calendar next week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "calendar last week" : function (test) {
<del> test.expect(15);
<ide>
<ide> var i, m;
<ide> for (i = 2; i < 7; i++) {
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "calendar all else" : function (test) {
<del> test.expect(4);
<ide>
<ide> var weeksAgo = moment().subtract({ w: 1 }),
<ide> weeksFromNow = moment().add({ w: 1 });
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "meridiem" : function (test) {
<del> test.expect(10);
<ide>
<ide> test.equal(moment([2011, 2, 23, 0, 0]).format('a'), "早上", "morning");
<ide> test.equal(moment([2011, 2, 23, 9, 0]).format('a'), "上午", "before noon");
<ide> exports["lang:zh-tw"] = {
<ide> // The week that contains Jan 1st is the first week of the year.
<ide>
<ide> "weeks year starting sunday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).week(), 1, "Jan 1 2012 should be week 1");
<ide> test.equal(moment([2012, 0, 7]).week(), 1, "Jan 7 2012 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting monday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2006, 11, 31]).week(), 1, "Dec 31 2006 should be week 1");
<ide> test.equal(moment([2007, 0, 1]).week(), 1, "Jan 1 2007 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting tuesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2007, 11, 29]).week(), 52, "Dec 29 2007 should be week 52");
<ide> test.equal(moment([2008, 0, 1]).week(), 1, "Jan 1 2008 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting wednesday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2002, 11, 29]).week(), 1, "Dec 29 2002 should be week 1");
<ide> test.equal(moment([2003, 0, 1]).week(), 1, "Jan 1 2003 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting thursday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2008, 11, 28]).week(), 1, "Dec 28 2008 should be week 1");
<ide> test.equal(moment([2009, 0, 1]).week(), 1, "Jan 1 2009 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting friday" : function (test) {
<del> test.expect(6);
<ide>
<ide> test.equal(moment([2009, 11, 27]).week(), 1, "Dec 27 2009 should be week 1");
<ide> test.equal(moment([2010, 0, 1]).week(), 1, "Jan 1 2010 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting saturday" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2010, 11, 26]).week(), 1, "Dec 26 2010 should be week 1");
<ide> test.equal(moment([2011, 0, 1]).week(), 1, "Jan 1 2011 should be week 1");
<ide> exports["lang:zh-tw"] = {
<ide> },
<ide>
<ide> "weeks year starting sunday format" : function (test) {
<del> test.expect(5);
<ide>
<ide> test.equal(moment([2012, 0, 1]).format('w ww wo'), '1 01 1週', "Jan 1 2012 應該是第 1週");
<ide> test.equal(moment([2012, 0, 7]).format('w ww wo'), '1 01 1週', "Jan 7 2012 應該是第 1週"); | 71 |
Python | Python | add test for new model parallelism features | 31484afbed45ee589f8e4e247b10188a09399734 | <ide><path>src/transformers/modeling_utils.py
<ide> def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
<ide> same device.
<ide>
<ide> To have Accelerate compute the most optimized `device_map` automatically, set `device_map="auto"`.
<add> max_memory (`Dict`, *optional*):
<add> A dictionary device identifier to maximum memory. Will default to the maximum memory available for each
<add> GPU and the available CPU RAM if unset.
<ide> offload_folder (`str` or `os.PathLike`, *optional*):
<ide> If the `device_map` contains any value `"disk"`, the folder where we will offload weights.
<ide> offload_state_dict (`bool`, *optional*, defaults to `False`):
<ide> def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
<ide> torch_dtype = kwargs.pop("torch_dtype", None)
<ide> low_cpu_mem_usage = kwargs.pop("low_cpu_mem_usage", None)
<ide> device_map = kwargs.pop("device_map", None)
<add> max_memory = kwargs.pop("max_memory", None)
<ide> offload_folder = kwargs.pop("offload_folder", None)
<ide> offload_state_dict = kwargs.pop("offload_state_dict", False)
<ide>
<ide> def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
<ide> if model._no_split_modules is None:
<ide> raise ValueError(f"{model.__class__.__name__} does not support `device_map='auto'` yet.")
<ide> no_split_modules = model._no_split_modules
<del> device_map = infer_auto_device_map(model, no_split_module_classes=no_split_modules, dtype=torch_dtype)
<add> device_map = infer_auto_device_map(
<add> model, no_split_module_classes=no_split_modules, dtype=torch_dtype, max_memory=max_memory
<add> )
<ide>
<ide> if from_tf:
<ide> if resolved_archive_file.endswith(".index"):
<ide><path>src/transformers/models/t5/modeling_t5.py
<ide> def _relative_position_bucket(relative_position, bidirectional=True, num_buckets
<ide> relative_buckets += torch.where(is_small, relative_position, relative_position_if_large)
<ide> return relative_buckets
<ide>
<del> def compute_bias(self, query_length, key_length):
<add> def compute_bias(self, query_length, key_length, device=None):
<ide> """Compute binned relative position bias"""
<del> context_position = torch.arange(
<del> query_length, dtype=torch.long, device=self.relative_attention_bias.weight.device
<del> )[:, None]
<del> memory_position = torch.arange(
<del> key_length, dtype=torch.long, device=self.relative_attention_bias.weight.device
<del> )[None, :]
<add> if device is None:
<add> device = self.relative_attention_bias.weight.device
<add> context_position = torch.arange(query_length, dtype=torch.long, device=device)[:, None]
<add> memory_position = torch.arange(key_length, dtype=torch.long, device=device)[None, :]
<ide> relative_position = memory_position - context_position # shape (query_length, key_length)
<ide> relative_position_bucket = self._relative_position_bucket(
<ide> relative_position, # shape (query_length, key_length)
<ide> def project(hidden_states, proj_layer, key_value_states, past_key_value):
<ide> if self.gradient_checkpointing and self.training:
<ide> position_bias.requires_grad = True
<ide> else:
<del> position_bias = self.compute_bias(real_seq_length, key_length)
<add> position_bias = self.compute_bias(real_seq_length, key_length, device=scores.device)
<ide>
<ide> # if key and values are already calculated
<ide> # we want only the last query position bias
<ide><path>tests/test_modeling_common.py
<ide> is_pt_flax_cross_test,
<ide> is_pt_tf_cross_test,
<ide> is_staging_test,
<add> require_accelerate,
<ide> require_torch,
<add> require_torch_gpu,
<ide> require_torch_multi_gpu,
<ide> require_usr_bin_time,
<ide> slow,
<ide> from transformers.utils import (
<ide> WEIGHTS_INDEX_NAME,
<ide> WEIGHTS_NAME,
<add> is_accelerate_available,
<ide> is_flax_available,
<ide> is_tf_available,
<ide> is_torch_fx_available,
<ide> from test_module.custom_configuration import CustomConfig, NoSuperInitConfig # noqa E402
<ide>
<ide>
<add>if is_accelerate_available():
<add> from accelerate.utils import compute_module_sizes
<add>
<add>
<ide> if is_torch_available():
<ide> import torch
<ide> from torch import nn
<ide> def cast_to_device(dictionary, device):
<ide> model.parallelize()
<ide> model.generate(**cast_to_device(inputs_dict, "cuda:0"), num_beams=2)
<ide>
<add> def check_device_map_is_respected(self, model, device_map):
<add> for param_name, param in model.named_parameters():
<add> # Find device in device_map
<add> while len(param_name) > 0 and param_name not in device_map:
<add> param_name = ".".join(param_name.split(".")[:-1])
<add> if param_name not in device_map:
<add> raise ValueError("device map is incomplete, it does not contain any device for `param_name`.")
<add>
<add> param_device = device_map[param_name]
<add> if param_device in ["cpu", "disk"]:
<add> self.assertEqual(param.device, torch.device("meta"))
<add> else:
<add> self.assertEqual(param.device, torch.device(param_device))
<add>
<add> @require_accelerate
<add> @require_torch_gpu
<add> def test_cpu_offload(self):
<add> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
<add> if config.num_hidden_layers < 5:
<add> config.num_hidden_layers = 5
<add>
<add> for model_class in self.all_model_classes:
<add> if model_class._no_split_modules is None:
<add> continue
<add>
<add> inputs_dict = self._prepare_for_class(inputs_dict, model_class)
<add> model = model_class(config).eval()
<add> model = model.to(torch_device)
<add> base_output = model(**inputs_dict)
<add>
<add> model_size = compute_module_sizes(model)[""]
<add> # We test several splits of sizes to make sure it works.
<add> max_gpu_sizes = [int(p * model_size) for p in [0.5, 0.7, 0.9]]
<add> with tempfile.TemporaryDirectory() as tmp_dir:
<add> model.cpu().save_pretrained(tmp_dir)
<add>
<add> for max_size in max_gpu_sizes:
<add> max_memory = {0: max_size, "cpu": model_size * 2}
<add> new_model = model_class.from_pretrained(tmp_dir, device_map="auto", max_memory=max_memory)
<add> # Making sure part of the model will actually end up offloaded
<add> self.assertSetEqual(set(new_model.hf_device_map.values()), {0, "cpu"})
<add>
<add> self.check_device_map_is_respected(new_model, new_model.hf_device_map)
<add> new_output = new_model(**inputs_dict)
<add>
<add> self.assertTrue(torch.allclose(base_output[0], new_output[0]))
<add>
<add> @require_accelerate
<add> @require_torch_multi_gpu
<add> def test_model_parallelism(self):
<add> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
<add> if config.num_hidden_layers < 5:
<add> config.num_hidden_layers = 5
<add>
<add> for model_class in self.all_model_classes:
<add> if model_class._no_split_modules is None:
<add> continue
<add>
<add> inputs_dict = self._prepare_for_class(inputs_dict, model_class)
<add> model = model_class(config).eval()
<add> model = model.to(torch_device)
<add> base_output = model(**inputs_dict)
<add>
<add> model_size = compute_module_sizes(model)[""]
<add> # We test several splits of sizes to make sure it works.
<add> max_gpu_sizes = [int(p * model_size) for p in [0.5, 0.7, 0.9]]
<add> with tempfile.TemporaryDirectory() as tmp_dir:
<add> model.cpu().save_pretrained(tmp_dir)
<add>
<add> for max_size in max_gpu_sizes:
<add> max_memory = {0: max_size, 1: model_size * 2, "cpu": model_size * 2}
<add> new_model = model_class.from_pretrained(tmp_dir, device_map="auto", max_memory=max_memory)
<add> # Making sure part of the model will actually end up offloaded
<add> self.assertSetEqual(set(new_model.hf_device_map.values()), {0, 1})
<add>
<add> self.check_device_map_is_respected(new_model, new_model.hf_device_map)
<add> new_output = new_model(**inputs_dict)
<add>
<add> self.assertTrue(torch.allclose(base_output[0], new_output[0]))
<add>
<ide> def test_problem_types(self):
<ide> config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common()
<ide>
<ide> def test_checkpoint_sharding_from_hub(self):
<ide> for p1, p2 in zip(model.parameters(), ref_model.parameters()):
<ide> self.assertTrue(torch.allclose(p1, p2))
<ide>
<add> @require_accelerate
<ide> def test_from_pretrained_low_cpu_mem_usage_functional(self):
<ide> # test that we can use `from_pretrained(..., low_cpu_mem_usage=True)` with normal and
<ide> # sharded models
<ide> def test_from_pretrained_low_cpu_mem_usage_functional(self):
<ide> _ = BertModel.from_pretrained(mname, low_cpu_mem_usage=True)
<ide>
<ide> @require_usr_bin_time
<add> @require_accelerate
<ide> def test_from_pretrained_low_cpu_mem_usage_measured(self):
<ide> # test that `from_pretrained(..., low_cpu_mem_usage=True)` uses less cpu memory than default
<ide>
<ide> def test_from_pretrained_low_cpu_mem_usage_measured(self):
<ide> # functionality to load models directly on gpu, this test can be rewritten to use torch's
<ide> # cuda memory tracking and then we should be able to do a much more precise test.
<ide>
<add> @require_accelerate
<ide> @require_torch_multi_gpu
<ide> @slow
<ide> def test_model_parallelism_gpt2(self): | 3 |
Javascript | Javascript | add yyyyyy format for iso string | ea18f28cbb303e08b33ad985e3daf5d3cd1643f6 | <ide><path>moment.js
<ide> isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
<ide>
<ide> // format tokens
<del> formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
<add> formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
<ide> localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
<ide>
<ide> // parsing token regexes
<ide> YYYYY : function () {
<ide> return leftZeroFill(this.year(), 5);
<ide> },
<add> YYYYYY : function () {
<add> var y = this.year(), sign = y >= 0 ? '+' : '-';
<add> return sign + leftZeroFill(Math.abs(y), 6);
<add> },
<ide> gg : function () {
<ide> return leftZeroFill(this.weekYear() % 100, 2);
<ide> },
<ide> case 'GGGG':
<ide> case 'gggg':
<ide> return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
<add> case 'YYYYYY':
<ide> case 'YYYYY':
<ide> case 'GGGGG':
<ide> case 'ggggg':
<ide> break;
<ide> case 'YYYY' :
<ide> case 'YYYYY' :
<add> case 'YYYYYY' :
<ide> datePartArray[YEAR] = toInt(input);
<ide> break;
<ide> // AM / PM
<ide><path>test/moment/format.js
<ide> exports.format = {
<ide> test.done();
<ide> },
<ide>
<add> "long years" : function (test) {
<add> test.expect(6);
<add> test.equal(moment.utc().year(2).format('YYYYYY'), '+000002', 'small year with YYYYYY');
<add> test.equal(moment.utc().year(2012).format('YYYYYY'), '+002012', 'regular year with YYYYYY');
<add> test.equal(moment.utc().year(20123).format('YYYYYY'), '+020123', 'big year with YYYYYY');
<add>
<add> test.equal(moment.utc().year(-1).format('YYYYYY'), '-000001', 'small negative year with YYYYYY');
<add> test.equal(moment.utc().year(-2012).format('YYYYYY'), '-002012', 'negative year with YYYYYY');
<add> test.equal(moment.utc().year(-20123).format('YYYYYY'), '-020123', 'big negative year with YYYYYY');
<add>
<add> test.done();
<add> },
<add>
<ide> "weeks format" : function (test) {
<ide>
<ide> // http://en.wikipedia.org/wiki/ISO_week_date | 2 |
Python | Python | remove unused import statement | cf8474401bea3d407535416923c65b433d28fd40 | <ide><path>spacy/fr/__init__.py
<ide> # encoding: utf8
<ide> from __future__ import unicode_literals, print_function
<ide>
<del>from os import path
<del>
<ide> from ..language import Language
<ide> from ..attrs import LANG
<ide> | 1 |
Python | Python | remove a handful of `import *` from the tests | 43920cd32e24eb293b445028c7710b42f9abc7c4 | <ide><path>tests/modeltests/mutually_referential/models.py
<ide> Strings can be used instead of model literals to set up "lazy" relations.
<ide> """
<ide>
<del>from django.db.models import *
<add>from django.db import models
<ide>
<del>class Parent(Model):
<del> name = CharField(max_length=100)
<add>
<add>class Parent(models.Model):
<add> name = models.CharField(max_length=100)
<ide>
<ide> # Use a simple string for forward declarations.
<del> bestchild = ForeignKey("Child", null=True, related_name="favoured_by")
<add> bestchild = models.ForeignKey("Child", null=True, related_name="favoured_by")
<ide>
<del>class Child(Model):
<del> name = CharField(max_length=100)
<add>class Child(models.Model):
<add> name = models.CharField(max_length=100)
<ide>
<ide> # You can also explicitally specify the related app.
<del> parent = ForeignKey("mutually_referential.Parent")
<add> parent = models.ForeignKey("mutually_referential.Parent")
<ide><path>tests/regressiontests/admin_custom_urls/urls.py
<del>from django.conf.urls.defaults import *
<add>from django.conf.urls import patterns, include
<ide> from django.contrib import admin
<ide>
<add>
<ide> urlpatterns = patterns('',
<ide> (r'^admin/', include(admin.site.urls)),
<ide> )
<ide><path>tests/regressiontests/dispatch/tests/test_saferef.py
<del>from django.dispatch.saferef import *
<del>
<add>from django.dispatch.saferef import safeRef
<ide> from django.utils import unittest
<ide>
<add>
<ide> class Test1(object):
<ide> def x(self):
<ide> pass
<ide> def setUp(self):
<ide> self.ts = ts
<ide> self.ss = ss
<ide> self.closureCount = 0
<del>
<add>
<ide> def tearDown(self):
<ide> del self.ts
<ide> del self.ss
<del>
<add>
<ide> def testIn(self):
<ide> """Test the "in" operator for safe references (cmp)"""
<ide> for t in self.ts[:50]:
<ide> self.assertTrue(safeRef(t.x) in self.ss)
<del>
<add>
<ide> def testValid(self):
<ide> """Test that the references are valid (return instance methods)"""
<ide> for s in self.ss:
<ide> self.assertTrue(s())
<del>
<add>
<ide> def testShortCircuit (self):
<ide> """Test that creation short-circuits to reuse existing references"""
<ide> sd = {}
<ide> def testShortCircuit (self):
<ide> else:
<ide> self.assertTrue(sd.has_key(safeRef(t)))
<ide> self.assertTrue(safeRef(t) in sd)
<del>
<add>
<ide> def testRepresentation (self):
<ide> """Test that the reference object's representation works
<del>
<add>
<ide> XXX Doesn't currently check the results, just that no error
<ide> is raised
<ide> """
<ide> repr(self.ss[-1])
<del>
<add>
<ide> def _closure(self, ref):
<ide> """Dumb utility mechanism to increment deletion counter"""
<ide> self.closureCount +=1
<ide><path>tests/regressiontests/forms/tests/error_messages.py
<ide> from django.test import TestCase
<ide> from django.utils.safestring import mark_safe
<ide> from django.utils import unittest
<add>
<ide> from regressiontests.forms.tests.fields import verify_exists_urls
<ide>
<add>
<ide> class AssertFormErrorsMixin(object):
<ide> def assertFormErrors(self, expected, the_callable, *args, **kwargs):
<ide> try:
<ide> def assertFormErrors(self, expected, the_callable, *args, **kwargs):
<ide> except ValidationError, e:
<ide> self.assertEqual(e.messages, expected)
<ide>
<del>
<ide> class FormsErrorMessagesTestCase(unittest.TestCase, AssertFormErrorsMixin):
<ide> def test_charfield(self):
<ide> e = {
<ide><path>tests/regressiontests/text/tests.py
<ide> # coding: utf-8
<ide> from __future__ import with_statement
<del>from django.test import TestCase
<ide>
<del>from django.utils.text import *
<del>from django.utils.http import urlquote, urlquote_plus, cookie_date, http_date
<add>from django.test import TestCase
<ide> from django.utils.encoding import iri_to_uri
<add>from django.utils.http import urlquote, urlquote_plus, cookie_date, http_date
<add>from django.utils.text import get_text_list, smart_split
<ide> from django.utils.translation import override
<ide>
<add>
<ide> class TextTests(TestCase):
<ide> """
<ide> Tests for stuff in django.utils.text and other text munging util functions.
<ide><path>tests/regressiontests/utils/datastructures.py
<ide> import pickle
<ide>
<ide> from django.test import SimpleTestCase
<del>from django.utils.datastructures import *
<add>from django.utils.datastructures import (DictWrapper, DotExpandedDict,
<add> ImmutableList, MultiValueDict, MultiValueDictKeyError, MergeDict, SortedDict)
<ide>
<ide>
<ide> class SortedDictTests(SimpleTestCase): | 6 |
Java | Java | add minor optimization to abstracterrors | 5068eb2e01a5f534b6ceaefe9d1034446b674164 | <ide><path>spring-context/src/main/java/org/springframework/validation/AbstractErrors.java
<ide> public Class<?> getFieldType(String field) {
<ide> * @return whether the FieldError matches the given field
<ide> */
<ide> protected boolean isMatchingFieldError(String field, FieldError fieldError) {
<del> return (field.equals(fieldError.getField()) ||
<del> (field.endsWith("*") && fieldError.getField().startsWith(field.substring(0, field.length() - 1))));
<add> if (field.equals(fieldError.getField())) {
<add> return true;
<add> }
<add> // Optimization: use chatAt instead of endsWith (SPR-11304, VESC-165)
<add> int endIndex = field.length() - 1;
<add> return (field.charAt(endIndex) == '*' && fieldError.getField().startsWith(field.substring(0, endIndex)));
<ide> }
<ide>
<ide> | 1 |
Go | Go | use container.hostconfig.shmsize directly | 0fb1fb1ce0177cf31dd96e9fdb4a5f55155a5966 | <ide><path>daemon/container_operations_unix.go
<ide> func (daemon *Daemon) setupIpcDirs(c *container.Container) error {
<ide> return err
<ide> }
<ide>
<del> shmSize := int64(daemon.configStore.ShmSize)
<del> if c.HostConfig.ShmSize != 0 {
<del> shmSize = c.HostConfig.ShmSize
<del> }
<del> shmproperty := "mode=1777,size=" + strconv.FormatInt(shmSize, 10)
<add> shmproperty := "mode=1777,size=" + strconv.FormatInt(c.HostConfig.ShmSize, 10)
<ide> if err := unix.Mount("shm", shmPath, "tmpfs", uintptr(unix.MS_NOEXEC|unix.MS_NOSUID|unix.MS_NODEV), label.FormatMountLabel(shmproperty, c.GetMountLabel())); err != nil {
<ide> return fmt.Errorf("mounting shm tmpfs: %s", err)
<ide> } | 1 |
Javascript | Javascript | change variable defined identifier let to const | d6d71197789e577ee6424f95b48aa6a8f099d1ae | <ide><path>lib/WebpackOptionsApply.js
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> }
<ide>
<ide> if (options.output.library || options.output.libraryTarget !== "var") {
<del> let LibraryTemplatePlugin = require("./LibraryTemplatePlugin");
<add> const LibraryTemplatePlugin = require("./LibraryTemplatePlugin");
<ide> new LibraryTemplatePlugin(
<ide> options.output.library,
<ide> options.output.libraryTarget,
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> : modern
<ide> ? "\n//# source" + "MappingURL=[url]"
<ide> : null;
<del> let Plugin = evalWrapped
<add> const Plugin = evalWrapped
<ide> ? EvalSourceMapDevToolPlugin
<ide> : SourceMapDevToolPlugin;
<ide> new Plugin({
<ide> class WebpackOptionsApply extends OptionsApply {
<ide> new WarnCaseSensitiveModulesPlugin().apply(compiler);
<ide>
<ide> if (options.cache) {
<del> let CachePlugin = require("./CachePlugin");
<add> const CachePlugin = require("./CachePlugin");
<ide> new CachePlugin(
<ide> typeof options.cache === "object" ? options.cache : null
<ide> ).apply(compiler); | 1 |
Javascript | Javascript | flow type actionsheetios | 61d046be3c9b00f6a4d4f492d558a961a6d4210f | <ide><path>Libraries/ActionSheetIOS/ActionSheetIOS.js
<ide> *
<ide> * @providesModule ActionSheetIOS
<ide> * @flow
<add> * @format
<ide> */
<ide> 'use strict';
<ide>
<del>var RCTActionSheetManager = require('NativeModules').ActionSheetManager;
<add>const RCTActionSheetManager = require('NativeModules').ActionSheetManager;
<ide>
<del>var invariant = require('fbjs/lib/invariant');
<del>var processColor = require('processColor');
<add>const invariant = require('fbjs/lib/invariant');
<add>const processColor = require('processColor');
<ide>
<ide> /**
<ide> * Display action sheets and share sheets on iOS.
<del> *
<add> *
<ide> * See http://facebook.github.io/react-native/docs/actionsheetios.html
<ide> */
<del>var ActionSheetIOS = {
<add>const ActionSheetIOS = {
<ide> /**
<ide> * Display an iOS action sheet.
<del> *
<add> *
<ide> * The `options` object must contain one or more of:
<del> *
<add> *
<ide> * - `options` (array of strings) - a list of button titles (required)
<ide> * - `cancelButtonIndex` (int) - index of cancel button in `options`
<ide> * - `destructiveButtonIndex` (int) - index of destructive button in `options`
<ide> * - `title` (string) - a title to show above the action sheet
<ide> * - `message` (string) - a message to show below the title
<del> *
<add> *
<ide> * The 'callback' function takes one parameter, the zero-based index
<ide> * of the selected item.
<del> *
<add> *
<ide> * See http://facebook.github.io/react-native/docs/actionsheetios.html#showactionsheetwithoptions
<ide> */
<del> showActionSheetWithOptions(options: Object, callback: Function) {
<add> showActionSheetWithOptions(
<add> options: {|
<add> +title?: ?string,
<add> +message?: ?string,
<add> +options: Array<string>,
<add> +destructiveButtonIndex?: ?number,
<add> +cancelButtonIndex?: ?number,
<add> +anchor?: ?number,
<add> +tintColor?: number | string,
<add> |},
<add> callback: (buttonIndex: number) => void,
<add> ) {
<ide> invariant(
<ide> typeof options === 'object' && options !== null,
<del> 'Options must be a valid object'
<del> );
<del> invariant(
<del> typeof callback === 'function',
<del> 'Must provide a valid callback'
<add> 'Options must be a valid object',
<ide> );
<add> invariant(typeof callback === 'function', 'Must provide a valid callback');
<add>
<ide> RCTActionSheetManager.showActionSheetWithOptions(
<ide> {...options, tintColor: processColor(options.tintColor)},
<del> callback
<add> callback,
<ide> );
<ide> },
<ide>
<ide> var ActionSheetIOS = {
<ide> * - `url` (string) - a URL to share
<ide> * - `message` (string) - a message to share
<ide> * - `subject` (string) - a subject for the message
<del> * - `excludedActivityTypes` (array) - the activities to exclude from
<add> * - `excludedActivityTypes` (array) - the activities to exclude from
<ide> * the ActionSheet
<ide> * - `tintColor` (color) - tint color of the buttons
<ide> *
<ide> var ActionSheetIOS = {
<ide> *
<ide> * - a boolean value signifying success or failure
<ide> * - a string that, in the case of success, indicates the method of sharing
<del> *
<add> *
<ide> * See http://facebook.github.io/react-native/docs/actionsheetios.html#showshareactionsheetwithoptions
<ide> */
<ide> showShareActionSheetWithOptions(
<ide> options: Object,
<ide> failureCallback: Function,
<del> successCallback: Function
<add> successCallback: Function,
<ide> ) {
<ide> invariant(
<ide> typeof options === 'object' && options !== null,
<del> 'Options must be a valid object'
<add> 'Options must be a valid object',
<ide> );
<ide> invariant(
<ide> typeof failureCallback === 'function',
<del> 'Must provide a valid failureCallback'
<add> 'Must provide a valid failureCallback',
<ide> );
<ide> invariant(
<ide> typeof successCallback === 'function',
<del> 'Must provide a valid successCallback'
<add> 'Must provide a valid successCallback',
<ide> );
<ide> RCTActionSheetManager.showShareActionSheetWithOptions(
<ide> {...options, tintColor: processColor(options.tintColor)},
<ide> failureCallback,
<del> successCallback
<add> successCallback,
<ide> );
<del> }
<add> },
<ide> };
<ide>
<ide> module.exports = ActionSheetIOS; | 1 |
Ruby | Ruby | use render instead render_to_body | 9d7d6cd7baf9b9e552a2ece8fca7f381417d06c1 | <ide><path>actionmailer/lib/action_mailer/base.rb
<ide> def collect_responses_and_parts_order(headers) #:nodoc:
<ide>
<ide> each_template(templates_path, templates_name) do |template|
<ide> responses << {
<del> :body => render_to_body(:_template => template),
<add> :body => render(:_template => template),
<ide> :content_type => template.mime_type.to_s
<ide> }
<ide> end
<ide><path>actionmailer/lib/action_mailer/old_api.rb
<ide> def create_parts
<ide> @parts.unshift create_inline_part(@body)
<ide> elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
<ide> self.class.view_paths.first.find_all(@template, {}, @mailer_name).each do |template|
<del> @parts << create_inline_part(render_to_body(:_template => template), template.mime_type)
<add> @parts << create_inline_part(render(:_template => template), template.mime_type)
<ide> end
<ide>
<ide> if @parts.size > 1 | 2 |
Go | Go | reduce duplication in graphdriver | 2028d8698d95fb73f0c59a548b8f2adbdf5057a4 | <ide><path>daemon/graphdriver/counter.go
<ide> func NewRefCounter(c Checker) *RefCounter {
<ide>
<ide> // Increment increaes the ref count for the given id and returns the current count
<ide> func (c *RefCounter) Increment(path string) int {
<del> c.mu.Lock()
<del> m := c.counts[path]
<del> if m == nil {
<del> m = &minfo{}
<del> c.counts[path] = m
<del> }
<del> // if we are checking this path for the first time check to make sure
<del> // if it was already mounted on the system and make sure we have a correct ref
<del> // count if it is mounted as it is in use.
<del> if !m.check {
<del> m.check = true
<del> if c.checker.IsMounted(path) {
<del> m.count++
<del> }
<del> }
<del> m.count++
<del> count := m.count
<del> c.mu.Unlock()
<del> return count
<add> return c.incdec(path, func(minfo *minfo) {
<add> minfo.count++
<add> })
<ide> }
<ide>
<ide> // Decrement decreases the ref count for the given id and returns the current count
<ide> func (c *RefCounter) Decrement(path string) int {
<add> return c.incdec(path, func(minfo *minfo) {
<add> minfo.count--
<add> })
<add>}
<add>
<add>func (c *RefCounter) incdec(path string, infoOp func(minfo *minfo)) int {
<ide> c.mu.Lock()
<ide> m := c.counts[path]
<ide> if m == nil {
<ide> func (c *RefCounter) Decrement(path string) int {
<ide> m.count++
<ide> }
<ide> }
<del> m.count--
<add> infoOp(m)
<ide> count := m.count
<ide> c.mu.Unlock()
<ide> return count
<del>}
<add>}
<ide>\ No newline at end of file
<ide><path>daemon/graphdriver/proxy.go
<ide> func (d *graphDriverProxy) String() string {
<ide> }
<ide>
<ide> func (d *graphDriverProxy) CreateReadWrite(id, parent string, opts *CreateOpts) error {
<del> args := &graphDriverRequest{
<del> ID: id,
<del> Parent: parent,
<del> }
<del> if opts != nil {
<del> args.MountLabel = opts.MountLabel
<del> args.StorageOpt = opts.StorageOpt
<del> }
<del>
<del> var ret graphDriverResponse
<del> if err := d.p.Client().Call("GraphDriver.CreateReadWrite", args, &ret); err != nil {
<del> return err
<del> }
<del> if ret.Err != "" {
<del> return errors.New(ret.Err)
<del> }
<del> return nil
<add> return d.create("GraphDriver.CreateReadWrite", id, parent, opts)
<ide> }
<ide>
<ide> func (d *graphDriverProxy) Create(id, parent string, opts *CreateOpts) error {
<add> return d.create("GraphDriver.Create", id, parent, opts)
<add>}
<add>
<add>func (d *graphDriverProxy) create(method, id, parent string, opts *CreateOpts) error {
<ide> args := &graphDriverRequest{
<ide> ID: id,
<ide> Parent: parent,
<ide> func (d *graphDriverProxy) Create(id, parent string, opts *CreateOpts) error {
<ide> args.StorageOpt = opts.StorageOpt
<ide> }
<ide> var ret graphDriverResponse
<del> if err := d.p.Client().Call("GraphDriver.Create", args, &ret); err != nil {
<add> if err := d.p.Client().Call(method, args, &ret); err != nil {
<ide> return err
<ide> }
<ide> if ret.Err != "" { | 2 |
Go | Go | fix integration tests | 661a8a0e0ce95d9bcb222184c14373fb1dbb1aec | <ide><path>integration/container_test.go
<ide> func TestIDFormat(t *testing.T) {
<ide> func TestMultipleAttachRestart(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<del> container, _ := mkContainer(
<add> container, _, _ := mkContainer(
<ide> runtime,
<ide> []string{"_", "/bin/sh", "-c", "i=1; while [ $i -le 5 ]; do i=`expr $i + 1`; echo hello; done"},
<ide> t,
<ide> func TestDiff(t *testing.T) {
<ide> runtime := mkRuntimeFromEngine(eng, t)
<ide> defer nuke(runtime)
<ide> // Create a container and remove a file
<del> container1, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t)
<add> container1, _, _ := mkContainer(runtime, []string{"_", "/bin/rm", "/etc/passwd"}, t)
<ide> defer runtime.Destroy(container1)
<ide>
<ide> // The changelog should be empty and not fail before run. See #1705
<ide> func TestDiff(t *testing.T) {
<ide> }
<ide>
<ide> // Create a new container from the commited image
<del> container2, _ := mkContainer(runtime, []string{img.ID, "cat", "/etc/passwd"}, t)
<add> container2, _, _ := mkContainer(runtime, []string{img.ID, "cat", "/etc/passwd"}, t)
<ide> defer runtime.Destroy(container2)
<ide>
<ide> if err := container2.Run(); err != nil {
<ide> func TestDiff(t *testing.T) {
<ide> }
<ide>
<ide> // Create a new container
<del> container3, _ := mkContainer(runtime, []string{"_", "rm", "/bin/httpd"}, t)
<add> container3, _, _ := mkContainer(runtime, []string{"_", "rm", "/bin/httpd"}, t)
<ide> defer runtime.Destroy(container3)
<ide>
<ide> if err := container3.Run(); err != nil {
<ide> func TestDiff(t *testing.T) {
<ide> func TestCommitAutoRun(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<del> container1, _ := mkContainer(runtime, []string{"_", "/bin/sh", "-c", "echo hello > /world"}, t)
<add> container1, _, _ := mkContainer(runtime, []string{"_", "/bin/sh", "-c", "echo hello > /world"}, t)
<ide> defer runtime.Destroy(container1)
<ide>
<ide> if container1.State.Running {
<ide> func TestCommitAutoRun(t *testing.T) {
<ide> }
<ide>
<ide> // FIXME: Make a TestCommit that stops here and check docker.root/layers/img.id/world
<del> container2, _ := mkContainer(runtime, []string{img.ID}, t)
<add> container2, _, _ := mkContainer(runtime, []string{img.ID}, t)
<ide> defer runtime.Destroy(container2)
<ide> stdout, err := container2.StdoutPipe()
<ide> if err != nil {
<ide> func TestCommitRun(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<ide>
<del> container1, _ := mkContainer(runtime, []string{"_", "/bin/sh", "-c", "echo hello > /world"}, t)
<add> container1, _, _ := mkContainer(runtime, []string{"_", "/bin/sh", "-c", "echo hello > /world"}, t)
<ide> defer runtime.Destroy(container1)
<ide>
<ide> if container1.State.Running {
<ide> func TestCommitRun(t *testing.T) {
<ide> }
<ide>
<ide> // FIXME: Make a TestCommit that stops here and check docker.root/layers/img.id/world
<del> container2, _ := mkContainer(runtime, []string{img.ID, "cat", "/world"}, t)
<add> container2, _, _ := mkContainer(runtime, []string{img.ID, "cat", "/world"}, t)
<ide> defer runtime.Destroy(container2)
<ide> stdout, err := container2.StdoutPipe()
<ide> if err != nil {
<ide> func TestCommitRun(t *testing.T) {
<ide> func TestStart(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<del> container, _ := mkContainer(runtime, []string{"-m", "33554432", "-c", "1000", "-i", "_", "/bin/cat"}, t)
<add> container, _, _ := mkContainer(runtime, []string{"-m", "33554432", "-c", "1000", "-i", "_", "/bin/cat"}, t)
<ide> defer runtime.Destroy(container)
<ide>
<ide> cStdin, err := container.StdinPipe()
<ide> func TestStart(t *testing.T) {
<ide> func TestRun(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<del> container, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<add> container, _, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<ide> defer runtime.Destroy(container)
<ide>
<ide> if container.State.Running {
<ide> func tempDir(t *testing.T) string {
<ide>
<ide> // Test for #1737
<ide> func TestCopyVolumeUidGid(t *testing.T) {
<del> r := mkRuntime(t)
<del> defer nuke(r)
<add> eng := NewTestEngine(t)
<add> r := mkRuntimeFromEngine(eng, t)
<add> defer r.Nuke()
<ide>
<ide> // Add directory not owned by root
<del> container1, _ := mkContainer(r, []string{"_", "/bin/sh", "-c", "mkdir -p /hello && touch /hello/test.txt && chown daemon.daemon /hello"}, t)
<add> container1, _, _ := mkContainer(r, []string{"_", "/bin/sh", "-c", "mkdir -p /hello && touch /hello/test.txt && chown daemon.daemon /hello"}, t)
<ide> defer r.Destroy(container1)
<ide>
<ide> if container1.State.Running {
<ide> func TestCopyVolumeUidGid(t *testing.T) {
<ide> // Test that the uid and gid is copied from the image to the volume
<ide> tmpDir1 := tempDir(t)
<ide> defer os.RemoveAll(tmpDir1)
<del> stdout1, _ := runContainer(r, []string{"-v", "/hello", img.ID, "stat", "-c", "%U %G", "/hello"}, t)
<add> stdout1, _ := runContainer(eng, r, []string{"-v", "/hello", img.ID, "stat", "-c", "%U %G", "/hello"}, t)
<ide> if !strings.Contains(stdout1, "daemon daemon") {
<ide> t.Fatal("Container failed to transfer uid and gid to volume")
<ide> }
<ide> }
<ide>
<ide> // Test for #1582
<ide> func TestCopyVolumeContent(t *testing.T) {
<del> r := mkRuntime(t)
<del> defer nuke(r)
<add> eng := NewTestEngine(t)
<add> r := mkRuntimeFromEngine(eng, t)
<add> defer r.Nuke()
<ide>
<ide> // Put some content in a directory of a container and commit it
<del> container1, _ := mkContainer(r, []string{"_", "/bin/sh", "-c", "mkdir -p /hello/local && echo hello > /hello/local/world"}, t)
<add> container1, _, _ := mkContainer(r, []string{"_", "/bin/sh", "-c", "mkdir -p /hello/local && echo hello > /hello/local/world"}, t)
<ide> defer r.Destroy(container1)
<ide>
<ide> if container1.State.Running {
<ide> func TestCopyVolumeContent(t *testing.T) {
<ide> // Test that the content is copied from the image to the volume
<ide> tmpDir1 := tempDir(t)
<ide> defer os.RemoveAll(tmpDir1)
<del> stdout1, _ := runContainer(r, []string{"-v", "/hello", img.ID, "find", "/hello"}, t)
<add> stdout1, _ := runContainer(eng, r, []string{"-v", "/hello", img.ID, "find", "/hello"}, t)
<ide> if !(strings.Contains(stdout1, "/hello/local/world") && strings.Contains(stdout1, "/hello/local")) {
<ide> t.Fatal("Container failed to transfer content to volume")
<ide> }
<ide> }
<ide>
<ide> func TestBindMounts(t *testing.T) {
<del> r := mkRuntime(t)
<del> defer nuke(r)
<add> eng := NewTestEngine(t)
<add> r := mkRuntimeFromEngine(eng, t)
<add> defer r.Nuke()
<add>
<ide> tmpDir := tempDir(t)
<ide> defer os.RemoveAll(tmpDir)
<ide> writeFile(path.Join(tmpDir, "touch-me"), "", t)
<ide>
<ide> // Test reading from a read-only bind mount
<del> stdout, _ := runContainer(r, []string{"-v", fmt.Sprintf("%s:/tmp:ro", tmpDir), "_", "ls", "/tmp"}, t)
<add> stdout, _ := runContainer(eng, r, []string{"-v", fmt.Sprintf("%s:/tmp:ro", tmpDir), "_", "ls", "/tmp"}, t)
<ide> if !strings.Contains(stdout, "touch-me") {
<ide> t.Fatal("Container failed to read from bind mount")
<ide> }
<ide>
<ide> // test writing to bind mount
<del> runContainer(r, []string{"-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "_", "touch", "/tmp/holla"}, t)
<add> runContainer(eng, r, []string{"-v", fmt.Sprintf("%s:/tmp:rw", tmpDir), "_", "touch", "/tmp/holla"}, t)
<ide> readFile(path.Join(tmpDir, "holla"), t) // Will fail if the file doesn't exist
<ide>
<ide> // test mounting to an illegal destination directory
<del> if _, err := runContainer(r, []string{"-v", fmt.Sprintf("%s:.", tmpDir), "_", "ls", "."}, nil); err == nil {
<add> if _, err := runContainer(eng, r, []string{"-v", fmt.Sprintf("%s:.", tmpDir), "_", "ls", "."}, nil); err == nil {
<ide> t.Fatal("Container bind mounted illegal directory")
<ide> }
<ide> }
<ide> func TestOnlyLoopbackExistsWhenUsingDisableNetworkOption(t *testing.T) {
<ide> }
<ide>
<ide> func TestPrivilegedCanMknod(t *testing.T) {
<del> runtime := mkRuntime(t)
<del> defer nuke(runtime)
<del> if output, _ := runContainer(runtime, []string{"-privileged", "_", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok"}, t); output != "ok\n" {
<add> eng := NewTestEngine(t)
<add> runtime := mkRuntimeFromEngine(eng, t)
<add> defer runtime.Nuke()
<add> if output, _ := runContainer(eng, runtime, []string{"-privileged", "_", "sh", "-c", "mknod /tmp/sda b 8 0 && echo ok"}, t); output != "ok\n" {
<ide> t.Fatal("Could not mknod into privileged container")
<ide> }
<ide> }
<ide>
<ide> func TestPrivilegedCanMount(t *testing.T) {
<del> runtime := mkRuntime(t)
<del> defer nuke(runtime)
<del> if output, _ := runContainer(runtime, []string{"-privileged", "_", "sh", "-c", "mount -t tmpfs none /tmp && echo ok"}, t); output != "ok\n" {
<add> eng := NewTestEngine(t)
<add> runtime := mkRuntimeFromEngine(eng, t)
<add> defer runtime.Nuke()
<add> if output, _ := runContainer(eng, runtime, []string{"-privileged", "_", "sh", "-c", "mount -t tmpfs none /tmp && echo ok"}, t); output != "ok\n" {
<ide> t.Fatal("Could not mount into privileged container")
<ide> }
<ide> }
<ide>
<ide> func TestPrivilegedCannotMknod(t *testing.T) {
<del> runtime := mkRuntime(t)
<del> defer nuke(runtime)
<del> if output, _ := runContainer(runtime, []string{"_", "sh", "-c", "mknod /tmp/sda b 8 0 || echo ok"}, t); output != "ok\n" {
<add> eng := NewTestEngine(t)
<add> runtime := mkRuntimeFromEngine(eng, t)
<add> defer runtime.Nuke()
<add> if output, _ := runContainer(eng, runtime, []string{"_", "sh", "-c", "mknod /tmp/sda b 8 0 || echo ok"}, t); output != "ok\n" {
<ide> t.Fatal("Could mknod into secure container")
<ide> }
<ide> }
<ide>
<ide> func TestPrivilegedCannotMount(t *testing.T) {
<del> runtime := mkRuntime(t)
<del> defer nuke(runtime)
<del> if output, _ := runContainer(runtime, []string{"_", "sh", "-c", "mount -t tmpfs none /tmp || echo ok"}, t); output != "ok\n" {
<add> eng := NewTestEngine(t)
<add> runtime := mkRuntimeFromEngine(eng, t)
<add> defer runtime.Nuke()
<add> if output, _ := runContainer(eng, runtime, []string{"_", "sh", "-c", "mount -t tmpfs none /tmp || echo ok"}, t); output != "ok\n" {
<ide> t.Fatal("Could mount into secure container")
<ide> }
<ide> }
<ide><path>integration/runtime_test.go
<ide> func TestGet(t *testing.T) {
<ide> runtime := mkRuntime(t)
<ide> defer nuke(runtime)
<ide>
<del> container1, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<add> container1, _, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<ide> defer runtime.Destroy(container1)
<ide>
<del> container2, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<add> container2, _, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<ide> defer runtime.Destroy(container2)
<ide>
<del> container3, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<add> container3, _, _ := mkContainer(runtime, []string{"_", "ls", "-al"}, t)
<ide> defer runtime.Destroy(container3)
<ide>
<ide> if runtime.Get(container1.ID) != container1 {
<ide> func TestRestore(t *testing.T) {
<ide> runtime1 := mkRuntimeFromEngine(eng, t)
<ide> defer runtime1.Nuke()
<ide> // Create a container with one instance of docker
<del> container1, _ := mkContainer(runtime1, []string{"_", "ls", "-al"}, t)
<add> container1, _, _ := mkContainer(runtime1, []string{"_", "ls", "-al"}, t)
<ide> defer runtime1.Destroy(container1)
<ide>
<ide> // Create a second container meant to be killed
<del> container2, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/cat"}, t)
<add> container2, _, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/cat"}, t)
<ide> defer runtime1.Destroy(container2)
<ide>
<ide> // Start the container non blocking
<ide> func TestRestore(t *testing.T) {
<ide>
<ide> // Here are are simulating a docker restart - that is, reloading all containers
<ide> // from scratch
<add> root := eng.Root()
<add> eng, err := engine.New(root)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide> job := eng.Job("initapi")
<ide> job.Setenv("Root", eng.Root())
<del> job.SetenvBool("AutoRestart", false)
<add> job.SetenvBool("Autorestart", false)
<ide> if err := job.Run(); err != nil {
<ide> t.Fatal(err)
<ide> }
<ide> func TestReloadContainerLinks(t *testing.T) {
<ide> runtime1 := mkRuntimeFromEngine(eng, t)
<ide> defer nuke(runtime1)
<ide> // Create a container with one instance of docker
<del> container1, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/sh"}, t)
<add> container1, _, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/sh"}, t)
<ide> defer runtime1.Destroy(container1)
<ide>
<ide> // Create a second container meant to be killed
<del> container2, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/cat"}, t)
<add> container2, _, _ := mkContainer(runtime1, []string{"-i", "_", "/bin/cat"}, t)
<ide> defer runtime1.Destroy(container2)
<ide>
<ide> // Start the container non blocking
<ide> func TestReloadContainerLinks(t *testing.T) {
<ide>
<ide> // Here are are simulating a docker restart - that is, reloading all containers
<ide> // from scratch
<add> eng, err = engine.New(root)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<ide> job = eng.Job("initapi")
<ide> job.Setenv("Root", eng.Root())
<del> job.SetenvBool("AutoRestart", false)
<add> job.SetenvBool("Autorestart", false)
<ide> if err := job.Run(); err != nil {
<ide> t.Fatal(err)
<ide> }
<add>
<ide> runtime2 := mkRuntimeFromEngine(eng, t)
<ide> if len(runtime2.List()) != 2 {
<ide> t.Errorf("Expected 2 container, %v found", len(runtime2.List()))
<ide><path>integration/utils_test.go
<ide> func readFile(src string, t *testing.T) (content string) {
<ide> // dynamically replaced by the current test image.
<ide> // The caller is responsible for destroying the container.
<ide> // Call t.Fatal() at the first error.
<del>func mkContainer(r *docker.Runtime, args []string, t *testing.T) (*docker.Container, error) {
<del> config, _, _, err := docker.ParseRun(args, nil)
<add>func mkContainer(r *docker.Runtime, args []string, t *testing.T) (*docker.Container, *docker.HostConfig, error) {
<add> config, hc, _, err := docker.ParseRun(args, nil)
<ide> defer func() {
<ide> if err != nil && t != nil {
<ide> t.Fatal(err)
<ide> }
<ide> }()
<ide> if err != nil {
<del> return nil, err
<add> return nil, nil, err
<ide> }
<ide> if config.Image == "_" {
<ide> config.Image = GetTestImage(r).ID
<ide> }
<ide> c, _, err := r.Create(config, "")
<ide> if err != nil {
<del> return nil, err
<add> return nil, nil, err
<ide> }
<ide> // NOTE: hostConfig is ignored.
<ide> // If `args` specify privileged mode, custom lxc conf, external mount binds,
<ide> func mkContainer(r *docker.Runtime, args []string, t *testing.T) (*docker.Contai
<ide> // to the `start` job.
<ide> // FIXME: this helper function should be deprecated in favor of calling
<ide> // `create` and `start` jobs directly.
<del> return c, nil
<add> return c, hc, nil
<ide> }
<ide>
<ide> // Create a test container, start it, wait for it to complete, destroy it,
<ide> // and return its standard output as a string.
<ide> // The image name (eg. the XXX in []string{"-i", "-t", "XXX", "bash"}, is dynamically replaced by the current test image.
<ide> // If t is not nil, call t.Fatal() at the first error. Otherwise return errors normally.
<del>func runContainer(r *docker.Runtime, args []string, t *testing.T) (output string, err error) {
<add>func runContainer(eng *engine.Engine, r *docker.Runtime, args []string, t *testing.T) (output string, err error) {
<ide> defer func() {
<ide> if err != nil && t != nil {
<ide> t.Fatal(err)
<ide> }
<ide> }()
<del> container, err := mkContainer(r, args, t)
<add> container, hc, err := mkContainer(r, args, t)
<ide> if err != nil {
<ide> return "", err
<ide> }
<ide> func runContainer(r *docker.Runtime, args []string, t *testing.T) (output string
<ide> return "", err
<ide> }
<ide> defer stdout.Close()
<del> if err := container.Start(); err != nil {
<add>
<add> job := eng.Job("start", container.ID)
<add> if err := job.ImportEnv(hc); err != nil {
<ide> return "", err
<ide> }
<add> if err := job.Run(); err != nil {
<add> return "", err
<add> }
<add>
<ide> container.Wait()
<ide> data, err := ioutil.ReadAll(stdout)
<ide> if err != nil { | 3 |
Go | Go | move syslog-tag to syslog.new function | 4f91a333d5c9d66ce109c36e7261dbfd3382ebbf | <ide><path>daemon/logger/syslog/syslog.go
<ide> import (
<ide>
<ide> type Syslog struct {
<ide> writer *syslog.Writer
<del> tag string
<ide> }
<ide>
<ide> func New(tag string) (logger.Logger, error) {
<del> log, err := syslog.New(syslog.LOG_USER, path.Base(os.Args[0]))
<add> log, err := syslog.New(syslog.LOG_USER, fmt.Sprintf("%s: <%s> ", path.Base(os.Args[0]), tag))
<ide> if err != nil {
<ide> return nil, err
<ide> }
<ide> return &Syslog{
<ide> writer: log,
<del> tag: tag,
<ide> }, nil
<ide> }
<ide>
<ide> func (s *Syslog) Log(msg *logger.Message) error {
<del> logMessage := fmt.Sprintf("%s: %s", s.tag, msg.Line)
<ide> if msg.Source == "stderr" {
<del> return s.writer.Err(logMessage)
<add> return s.writer.Err(string(msg.Line))
<ide> }
<del> return s.writer.Info(logMessage)
<add> return s.writer.Info(string(msg.Line))
<ide> }
<ide>
<ide> func (s *Syslog) Close() error { | 1 |
Text | Text | correct some typos | 88f400af91b3c672cf9ad1d04cbd7752a4bea232 | <ide><path>guide/english/python/data-structures/tuples/index.md
<ide> A `tuple` can also be created with the `tuple` constructor:
<ide> ```
<ide> **Accessing elements of a `tuple`:**
<ide>
<del>Elements of `tuples` are accessed and index the same way that `lists` are.
<add>Elements of `tuples` are accessed and indexed the same way that `lists` are.
<ide> ```shell
<ide> >>> my_tuple = 1, 2, 9, 16, 25
<ide> >>> print(my_tuple)
<ide> This is called, appropriately enough, sequence unpacking and works for any seque
<ide> ```
<ide> **Immutable:**
<ide>
<del>`tuples` are immutable containers, guaranteeing **which** objects they contain will not change. It does **not** guarantee that the objects they contains will not change:
<add>`tuples` are immutable containers, guaranteeing **which** objects they contain will not change. It does **not** guarantee that the objects they contain will not change:
<ide> ```shell
<ide> >>> a_list = []
<ide> >>> a_tuple = (a_list,) # A tuple (immutable) with a list (mutable) element.
<ide> This is called, appropriately enough, sequence unpacking and works for any seque
<ide> ```
<ide> **Uses:**
<ide>
<del>Functions can only return a single value, however, a heterogenuous `tuple` can be used to return multiple values from a function. One example is the built-in `enumerate` function that returns an iterable of heterogenuous `tuples`:
<add>Functions can only return a single value, however, a heterogeneous `tuple` can be used to return multiple values from a function. One example is the built-in `enumerate` function that returns an iterable of heterogeneous `tuples`:
<ide> ```shell
<ide> >>> greeting = ["Hello", "campers!"]
<ide> >>> enumerator = enumerate(greeting) | 1 |
Ruby | Ruby | remove outdated dev-utils | a8f36e88dd322f78efe0a54eb73a7e3b9fd60479 | <ide><path>activerecord/dev-utils/eval_debugger.rb
<del># Require this file to see the methods Active Record generates as they are added.
<del>class Module #:nodoc:
<del> alias :old_module_eval :module_eval
<del> def module_eval(*args, &block)
<del> if args[0]
<del> puts "----"
<del> print "module_eval in #{self.name}"
<del> print ": file #{args[1]}" if args[1]
<del> print " on line #{args[2]}" if args[2]
<del> puts "\n#{args[0]}"
<del> end
<del> old_module_eval(*args, &block)
<del> end
<del>end
<ide><path>activerecord/test/aggregations_test.rb
<ide> require 'abstract_unit'
<del># require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'fixtures/customer'
<ide>
<ide> class AggregationsTest < Test::Unit::TestCase
<ide><path>activerecord/test/associations_test.rb
<ide> require 'abstract_unit'
<ide> require 'fixtures/developer'
<ide> require 'fixtures/project'
<del># require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'fixtures/company'
<ide> require 'fixtures/topic'
<ide> require 'fixtures/reply'
<ide><path>activerecord/test/deprecated_associations_test.rb
<ide> require 'fixtures/project'
<ide> require 'fixtures/company'
<ide> require 'fixtures/topic'
<del># require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'fixtures/reply'
<ide>
<ide> # Can't declare new classes in test case methods, so tests before that
<ide><path>activerecord/test/lifecycle_test.rb
<del># require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'abstract_unit'
<ide> require 'fixtures/topic'
<ide> require 'fixtures/developer'
<ide><path>activerecord/test/modules_test.rb
<ide> require 'abstract_unit'
<del># require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'fixtures/company_in_module'
<ide>
<ide> class ModulesTest < Test::Unit::TestCase
<ide><path>activerecord/test/reflection_test.rb
<del>#require File.dirname(__FILE__) + '/../dev-utils/eval_debugger'
<ide> require 'abstract_unit'
<ide> require 'fixtures/topic'
<ide> require 'fixtures/customer' | 7 |
Javascript | Javascript | remove unnecessary bind from setimmediate | af6c88c571ae0a00d9b6a8a62379635deab21cb5 | <ide><path>lib/internal/http2/core.js
<ide> class Http2Stream extends Duplex {
<ide> // By using setImmediate we allow pushStreams to make it through
<ide> // before the stream is officially closed. This prevents a bug
<ide> // in most browsers where those pushStreams would be rejected.
<del> setImmediate(this.close.bind(this));
<add> setImmediate(callStreamClose, this);
<ide> }
<ide> }
<ide> }
<ide> }
<ide>
<add>function callStreamClose(stream) {
<add> stream.close();
<add>}
<add>
<ide> function processHeaders(oldHeaders) {
<ide> assertIsObject(oldHeaders, 'headers');
<ide> const headers = ObjectCreate(null); | 1 |
Javascript | Javascript | throw error when url.parse without true is parsed | 40738c6e44ffd901be0935bbf865ed19499d7ece | <ide><path>server/index.js
<ide> import { resolve, join } from 'path'
<del>import { parse } from 'url'
<add>import { parse as parseUrl } from 'url'
<add>import { parse as parseQs } from 'querystring'
<ide> import fs from 'mz/fs'
<ide> import http, { STATUS_CODES } from 'http'
<ide> import {
<ide> export default class Server {
<ide>
<ide> getRequestHandler () {
<ide> return (req, res, parsedUrl) => {
<add> // Parse url if parsedUrl not provided
<ide> if (!parsedUrl) {
<del> parsedUrl = parse(req.url, true)
<add> parsedUrl = parseUrl(req.url, true)
<ide> }
<ide>
<del> if (!parsedUrl.query) {
<del> throw new Error('Please provide a parsed url to `handle` as third parameter. See https://github.com/zeit/next.js#custom-server-and-routing for an example.')
<add> // Parse the querystring ourselves if the user doesn't handle querystring parsing
<add> if (typeof parsedUrl.query === 'string') {
<add> parsedUrl.query = parseQs(parsedUrl.query)
<ide> }
<ide>
<ide> return this.run(req, res, parsedUrl)
<ide> export default class Server {
<ide> }
<ide> }
<ide>
<del> async render404 (req, res, parsedUrl = parse(req.url, true)) {
<add> async render404 (req, res, parsedUrl = parseUrl(req.url, true)) {
<ide> const { pathname, query } = parsedUrl
<ide> res.statusCode = 404
<ide> return this.renderError(null, req, res, pathname, query) | 1 |
Javascript | Javascript | remove edge version from the user agent | 5a1217e40193c8884155ccaf415091d326ddb52a | <ide><path>test/unit/support.js
<ide> testIframeWithCallback( "Check CSP (https://developer.mozilla.org/en-US/docs/Sec
<ide> var expected,
<ide> userAgent = window.navigator.userAgent;
<ide>
<del> if ( /edge\/12/i.test( userAgent ) ) {
<add> if ( /edge\//i.test( userAgent ) ) {
<ide> expected = {
<ide> "ajax": true,
<ide> "boxSizingReliable": true, | 1 |
PHP | PHP | apply fixes from styleci | 28b8111dac789b248c3c5f7887912c09ce37df0a | <ide><path>tests/Validation/ValidationValidatorTest.php
<ide> public function __toString()
<ide> {
<ide> return 'aslsdlks';
<ide> }
<del> }
<add> },
<ide> ], ['x' => 'Email']);
<ide> $this->assertFalse($v->passes());
<ide>
<ide> public function __toString()
<ide> {
<ide> return 'foo@gmail.com';
<ide> }
<del> }
<add> },
<ide> ], ['x' => 'Email']);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateAlpha()
<ide> $v = new Validator($trans, [
<ide> 'x' => 'aslsdlks
<ide> 1
<del>1'
<add>1',
<ide> ], ['x' => 'Alpha']);
<ide> $this->assertFalse($v->passes());
<ide>
<ide> public function testCustomValidators()
<ide> $v->addExtensions([
<ide> 'FooBar' => function () {
<ide> return false;
<del> }
<add> },
<ide> ]);
<ide> $v->setFallbackMessages(['foo_bar' => 'foo!']);
<ide> $this->assertFalse($v->passes());
<ide> public function testValidateImplicitEachWithAsterisksForRequiredNonExistingKey()
<ide> $data = [
<ide> 'people' => [
<ide> ['cars' => [['model' => 2005], []]],
<del> ]
<add> ],
<ide> ];
<ide> $v = new Validator($trans, $data, ['people.*.cars.*.model' => 'required']);
<ide> $this->assertFalse($v->passes());
<ide>
<ide> $data = [
<ide> 'people' => [
<ide> ['name' => 'test', 'cars' => [['model' => 2005], ['name' => 'test2']]],
<del> ]
<add> ],
<ide> ];
<ide> $v = new Validator($trans, $data, ['people.*.cars.*.model' => 'required']);
<ide> $this->assertFalse($v->passes());
<ide>
<ide> $data = [
<ide> 'people' => [
<ide> ['phones' => ['iphone', 'android'], 'cars' => [['model' => 2005], ['name' => 'test2']]],
<del> ]
<add> ],
<ide> ];
<ide> $v = new Validator($trans, $data, ['people.*.cars.*.model' => 'required']);
<ide> $this->assertFalse($v->passes());
<ide> public function testPassingSlashVulnerability()
<ide> ]);
<ide> $this->assertTrue($v->passes());
<ide>
<del>
<ide> $v = new Validator($trans, [
<ide> 'foo' => ['bar' => 'valid'], 'foo.bar' => 'invalid', 'foo->bar' => 'valid',
<ide> ], [
<ide> public function testValidateImplicitEachWithAsterisksConfirmed()
<ide> 'foo' => [
<ide> ['password' => 'foo0', 'password_confirmation' => 'foo0'],
<ide> ['password' => 'foo1', 'password_confirmation' => 'foo1'],
<del> ]
<add> ],
<ide> ], ['foo.*.password' => 'confirmed']);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksConfirmed()
<ide> 'bar' => [
<ide> ['password' => 'bar0', 'password_confirmation' => 'bar0'],
<ide> ['password' => 'bar1', 'password_confirmation' => 'bar1'],
<del> ]
<add> ],
<ide> ],
<ide> [
<ide> 'bar' => [
<ide> ['password' => 'bar2', 'password_confirmation' => 'bar2'],
<ide> ['password' => 'bar3', 'password_confirmation' => 'bar3'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.password' => 'confirmed']);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksConfirmed()
<ide> 'foo' => [
<ide> ['password' => 'foo0', 'password_confirmation' => 'bar0'],
<ide> ['password' => 'foo1'],
<del> ]
<add> ],
<ide> ], ['foo.*.password' => 'confirmed']);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.password'));
<ide> public function testValidateImplicitEachWithAsterisksConfirmed()
<ide> 'bar' => [
<ide> ['password' => 'bar0'],
<ide> ['password' => 'bar1', 'password_confirmation' => 'bar2'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.password' => 'confirmed']);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.password'));
<ide> public function testValidateImplicitEachWithAsterisksDifferent()
<ide> 'foo' => [
<ide> ['name' => 'foo', 'last' => 'bar'],
<ide> ['name' => 'bar', 'last' => 'foo'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['different:foo.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksDifferent()
<ide> 'bar' => [
<ide> ['name' => 'foo', 'last' => 'bar'],
<ide> ['name' => 'bar', 'last' => 'foo'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['different:foo.*.bar.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksDifferent()
<ide> 'foo' => [
<ide> ['name' => 'foo', 'last' => 'foo'],
<ide> ['name' => 'bar', 'last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['different:foo.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksDifferent()
<ide> 'bar' => [
<ide> ['name' => 'foo', 'last' => 'foo'],
<ide> ['name' => 'bar', 'last' => 'bar'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['different:foo.*.bar.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksSame()
<ide> 'foo' => [
<ide> ['name' => 'foo', 'last' => 'foo'],
<ide> ['name' => 'bar', 'last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['same:foo.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksSame()
<ide> 'bar' => [
<ide> ['name' => 'foo', 'last' => 'foo'],
<ide> ['name' => 'bar', 'last' => 'bar'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['same:foo.*.bar.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksSame()
<ide> 'foo' => [
<ide> ['name' => 'foo', 'last' => 'bar'],
<ide> ['name' => 'bar', 'last' => 'foo'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['same:foo.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksSame()
<ide> 'bar' => [
<ide> ['name' => 'foo', 'last' => 'bar'],
<ide> ['name' => 'bar', 'last' => 'foo'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['same:foo.*.bar.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequired()
<ide> 'foo' => [
<ide> ['name' => 'first'],
<ide> ['name' => 'second'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequired()
<ide> 'foo' => [
<ide> ['name' => 'first'],
<ide> ['name' => 'second'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequired()
<ide> 'foo' => [
<ide> ['name' => null],
<ide> ['name' => null, 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequired()
<ide> 'bar' => [
<ide> ['name' => null],
<ide> ['name' => null],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredIf()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'foo'],
<ide> ['last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_if:foo.*.last,foo']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredIf()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'foo'],
<ide> ['last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_if:foo.*.last,foo']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredIf()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'foo'],
<ide> ['name' => null, 'last' => 'foo'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_if:foo.*.last,foo']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredIf()
<ide> 'bar' => [
<ide> ['name' => null, 'last' => 'foo'],
<ide> ['name' => null, 'last' => 'foo'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_if:foo.*.bar.*.last,foo']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredUnless()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'foo'],
<ide> ['name' => 'second', 'last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_unless:foo.*.last,foo']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredUnless()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'foo'],
<ide> ['name' => 'second', 'last' => 'foo'],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_unless:foo.*.bar.*.last,foo']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredUnless()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'baz'],
<ide> ['name' => null, 'last' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_unless:foo.*.last,foo']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredUnless()
<ide> 'bar' => [
<ide> ['name' => null, 'last' => 'bar'],
<ide> ['name' => null, 'last' => 'bar'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_unless:foo.*.bar.*.last,foo']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWith()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'last'],
<ide> ['name' => 'second', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with:foo.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWith()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'last'],
<ide> ['name' => 'second', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with:foo.*.last']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWith()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'last'],
<ide> ['name' => null, 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with:foo.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWith()
<ide> 'fields' => [
<ide> 'fr' => ['name' => '', 'content' => 'ragnar'],
<ide> 'es' => ['name' => '', 'content' => 'lagertha'],
<del> ]
<add> ],
<ide> ], ['fields.*.name' => 'required_with:fields.*.content']);
<ide> $this->assertFalse($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWith()
<ide> 'bar' => [
<ide> ['name' => null, 'last' => 'last'],
<ide> ['name' => null, 'last' => 'last'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_with:foo.*.bar.*.last']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithAll()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'last', 'middle' => 'middle'],
<ide> ['name' => 'second', 'last' => 'last', 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithAll()
<ide> 'foo' => [
<ide> ['name' => 'first', 'last' => 'last', 'middle' => 'middle'],
<ide> ['name' => 'second', 'last' => 'last', 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithAll()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'last', 'middle' => 'middle'],
<ide> ['name' => null, 'last' => 'last', 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_with_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithAll()
<ide> 'bar' => [
<ide> ['name' => null, 'last' => 'last', 'middle' => 'middle'],
<ide> ['name' => null, 'last' => 'last', 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_with_all:foo.*.bar.*.last,foo.*.bar.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithout()
<ide> 'foo' => [
<ide> ['name' => 'first', 'middle' => 'middle'],
<ide> ['name' => 'second', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithout()
<ide> 'foo' => [
<ide> ['name' => 'first', 'middle' => 'middle'],
<ide> ['name' => 'second', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithout()
<ide> 'foo' => [
<ide> ['name' => null, 'last' => 'last'],
<ide> ['name' => null, 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without:foo.*.last,foo.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithout()
<ide> 'bar' => [
<ide> ['name' => null, 'last' => 'last'],
<ide> ['name' => null, 'middle' => 'middle'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_without:foo.*.bar.*.last,foo.*.bar.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithoutAll()
<ide> ['name' => 'first'],
<ide> ['name' => null, 'middle' => 'middle'],
<ide> ['name' => null, 'middle' => 'middle', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithoutAll()
<ide> ['name' => 'first'],
<ide> ['name' => null, 'middle' => 'middle'],
<ide> ['name' => null, 'middle' => 'middle', 'last' => 'last'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> $v = new Validator($trans, [
<ide> 'foo' => [
<ide> ['name' => null, 'foo' => 'foo', 'bar' => 'bar'],
<ide> ['name' => null, 'foo' => 'foo', 'bar' => 'bar'],
<del> ]
<add> ],
<ide> ], ['foo.*.name' => ['Required_without_all:foo.*.last,foo.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksRequiredWithoutAll()
<ide> 'bar' => [
<ide> ['name' => null, 'foo' => 'foo', 'bar' => 'bar'],
<ide> ['name' => null, 'foo' => 'foo', 'bar' => 'bar'],
<del> ]
<add> ],
<ide> ],
<del> ]
<add> ],
<ide> ], ['foo.*.bar.*.name' => ['Required_without_all:foo.*.bar.*.last,foo.*.bar.*.middle']]);
<ide> $this->assertFalse($v->passes());
<ide> $this->assertTrue($v->messages()->has('foo.0.bar.0.name'));
<ide> public function testValidateImplicitEachWithAsterisksBeforeAndAfter()
<ide> $v = new Validator($trans, [
<ide> 'foo' => [
<ide> ['start' => '2016-04-19', 'end' => '2017-04-19'],
<del> ]
<add> ],
<ide> ], ['foo.*.start' => ['before:foo.*.end']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> $v = new Validator($trans, [
<ide> 'foo' => [
<ide> ['start' => '2016-04-19', 'end' => '2017-04-19'],
<del> ]
<add> ],
<ide> ], ['foo.*.end' => ['before:foo.*.start']]);
<ide> $this->assertTrue($v->fails());
<ide>
<ide> $v = new Validator($trans, [
<ide> 'foo' => [
<ide> ['start' => '2016-04-19', 'end' => '2017-04-19'],
<del> ]
<add> ],
<ide> ], ['foo.*.end' => ['after:foo.*.start']]);
<ide> $this->assertTrue($v->passes());
<ide>
<ide> $v = new Validator($trans, [
<ide> 'foo' => [
<ide> ['start' => '2016-04-19', 'end' => '2017-04-19'],
<del> ]
<add> ],
<ide> ], ['foo.*.start' => ['after:foo.*.end']]);
<ide> $this->assertTrue($v->fails());
<ide> }
<ide> public function message()
<ide> {
<ide> return ':attribute must be taylor';
<ide> }
<del> }
<add> },
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> {
<ide> return ':attribute must be taylor';
<ide> }
<del> }
<del> ]
<add> },
<add> ],
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> if ($value !== 'taylor') {
<ide> $fail(':attribute was '.$value.' instead of taylor');
<ide> }
<del> }
<add> },
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> if ($value !== 'taylor') {
<ide> $fail(':attribute was '.$value.' instead of taylor');
<ide> }
<del> }
<add> },
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> {
<ide> return [':attribute must be taylor', ':attribute must be a first name'];
<ide> }
<del> }
<add> },
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> {
<ide> return [':attribute must be taylor', ':attribute must be a first name'];
<ide> }
<del> }, 'string'
<del> ]
<add> }, 'string',
<add> ],
<ide> ]
<ide> );
<ide>
<ide> public function message()
<ide> {
<ide> return 'message';
<ide> }
<del> }
<add> },
<ide> ]
<ide> );
<ide>
<ide> public function providesPassingExcludeIfData()
<ide> 'has_appointment' => ['required', 'bool'],
<ide> 'appointment_date' => ['exclude_if:has_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_appointment' => false,
<del> 'appointment_date' => 'should be excluded',
<del> ], [
<del> 'has_appointment' => false,
<del> ],
<add> 'has_appointment' => false,
<add> 'appointment_date' => 'should be excluded',
<add> ], [
<add> 'has_appointment' => false,
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'cat' => ['required', 'string'],
<ide> 'mouse' => ['exclude_if:cat,Tom', 'required', 'file'],
<ide> ], [
<del> 'cat' => 'Tom',
<del> 'mouse' => 'should be excluded',
<del> ], [
<del> 'cat' => 'Tom',
<del> ],
<add> 'cat' => 'Tom',
<add> 'mouse' => 'should be excluded',
<add> ], [
<add> 'cat' => 'Tom',
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'has_appointment' => ['required', 'bool'],
<ide> 'appointment_date' => ['exclude_if:has_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_appointment' => false,
<del> ], [
<del> 'has_appointment' => false,
<del> ],
<add> 'has_appointment' => false,
<add> ], [
<add> 'has_appointment' => false,
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'has_appointment' => ['required', 'bool'],
<ide> 'appointment_date' => ['exclude_if:has_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_appointment' => true,
<del> 'appointment_date' => '2019-12-13',
<del> ], [
<del> 'has_appointment' => true,
<del> 'appointment_date' => '2019-12-13',
<del> ],
<add> 'has_appointment' => true,
<add> 'appointment_date' => '2019-12-13',
<add> ], [
<add> 'has_appointment' => true,
<add> 'appointment_date' => '2019-12-13',
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'has_no_appointments' => ['required', 'bool'],
<ide> 'has_doctor_appointment' => ['exclude_if:has_no_appointments,true', 'required', 'bool'],
<ide> 'doctor_appointment_date' => ['exclude_if:has_no_appointments,true', 'exclude_if:has_doctor_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_no_appointments' => true,
<del> 'has_doctor_appointment' => true,
<del> 'doctor_appointment_date' => '2019-12-13',
<del> ], [
<del> 'has_no_appointments' => true,
<del> ],
<add> 'has_no_appointments' => true,
<add> 'has_doctor_appointment' => true,
<add> 'doctor_appointment_date' => '2019-12-13',
<add> ], [
<add> 'has_no_appointments' => true,
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'has_no_appointments' => ['required', 'bool'],
<ide> 'has_doctor_appointment' => ['exclude_if:has_no_appointments,true', 'required', 'bool'],
<ide> 'doctor_appointment_date' => ['exclude_if:has_no_appointments,true', 'exclude_if:has_doctor_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_no_appointments' => false,
<del> 'has_doctor_appointment' => false,
<del> 'doctor_appointment_date' => 'should be excluded',
<del> ], [
<del> 'has_no_appointments' => false,
<del> 'has_doctor_appointment' => false,
<del> ],
<add> 'has_no_appointments' => false,
<add> 'has_doctor_appointment' => false,
<add> 'doctor_appointment_date' => 'should be excluded',
<add> ], [
<add> 'has_no_appointments' => false,
<add> 'has_doctor_appointment' => false,
<add> ],
<ide> ],
<ide> 'nested-01' => [
<ide> [
<ide> public function providesPassingExcludeIfData()
<ide> 'vehicles' => [
<ide> [
<ide> 'type' => 'car', 'wheels' => [
<del> ['color' => 'red', 'shape' => 'square'],
<del> ['color' => 'blue', 'shape' => 'hexagon'],
<del> ['color' => 'red', 'shape' => 'round', 'junk' => 'no rule, still present'],
<del> ['color' => 'blue', 'shape' => 'triangle'],
<del> ]
<add> ['color' => 'red', 'shape' => 'square'],
<add> ['color' => 'blue', 'shape' => 'hexagon'],
<add> ['color' => 'red', 'shape' => 'round', 'junk' => 'no rule, still present'],
<add> ['color' => 'blue', 'shape' => 'triangle'],
<add> ],
<ide> ],
<ide> ['type' => 'boat'],
<ide> ],
<ide> ], [
<ide> 'vehicles' => [
<ide> [
<ide> 'type' => 'car', 'wheels' => [
<del> // The shape field for these blue wheels were correctly excluded (if they weren't, they would
<del> // fail the validation). They still appear in the validated data. This behaviour is unrelated
<del> // to the "exclude" type rules.
<del> ['color' => 'red', 'shape' => 'square'],
<del> ['color' => 'blue', 'shape' => 'hexagon'],
<del> ['color' => 'red', 'shape' => 'round', 'junk' => 'no rule, still present'],
<del> ['color' => 'blue', 'shape' => 'triangle'],
<del> ]
<add> // The shape field for these blue wheels were correctly excluded (if they weren't, they would
<add> // fail the validation). They still appear in the validated data. This behaviour is unrelated
<add> // to the "exclude" type rules.
<add> ['color' => 'red', 'shape' => 'square'],
<add> ['color' => 'blue', 'shape' => 'hexagon'],
<add> ['color' => 'red', 'shape' => 'round', 'junk' => 'no rule, still present'],
<add> ['color' => 'blue', 'shape' => 'triangle'],
<add> ],
<ide> ],
<ide> ['type' => 'boat'],
<ide> ],
<ide> public function providesFailingExcludeIfData()
<ide> 'has_appointment' => ['required', 'bool'],
<ide> 'appointment_date' => ['exclude_if:has_appointment,false', 'required', 'date'],
<ide> ], [
<del> 'has_appointment' => true,
<del> ], [
<del> 'appointment_date' => ['validation.required'],
<del> ],
<add> 'has_appointment' => true,
<add> ], [
<add> 'appointment_date' => ['validation.required'],
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> 'cat' => ['required', 'string'],
<ide> 'mouse' => ['exclude_if:cat,Tom', 'required', 'file'],
<ide> ], [
<del> 'cat' => 'Bob',
<del> 'mouse' => 'not a file',
<del> ], [
<del> 'mouse' => ['validation.file'],
<del> ],
<add> 'cat' => 'Bob',
<add> 'mouse' => 'not a file',
<add> ], [
<add> 'mouse' => ['validation.file'],
<add> ],
<ide> ],
<ide> [
<ide> [
<ide> public function providesFailingExcludeIfData()
<ide> 'appointments.*.date' => ['required', 'date'],
<ide> 'appointments.*.name' => ['required', 'string'],
<ide> ], [
<del> 'has_appointments' => true,
<del> 'appointments' => [
<del> ['date' => 'invalid', 'name' => 'Bob'],
<del> ['date' => '2019-05-15'],
<add> 'has_appointments' => true,
<add> 'appointments' => [
<add> ['date' => 'invalid', 'name' => 'Bob'],
<add> ['date' => '2019-05-15'],
<add> ],
<add> ], [
<add> 'appointments.0.date' => ['validation.date'],
<add> 'appointments.1.name' => ['validation.required'],
<ide> ],
<del> ], [
<del> 'appointments.0.date' => ['validation.date'],
<del> 'appointments.1.name' => ['validation.required'],
<del> ],
<ide> ],
<ide> [
<ide> [
<ide> 'vehicles.*.price' => 'required|numeric',
<ide> 'vehicles.*.type' => 'required|in:car,boat',
<ide> 'vehicles.*.wheels' => 'exclude_if:vehicles.*.type,boat|required|numeric',
<ide> ], [
<del> 'vehicles' => [
<del> [
<del> 'price' => 100,
<del> 'type' => 'car',
<del> ],
<del> [
<del> 'price' => 500,
<del> 'type' => 'boat',
<add> 'vehicles' => [
<add> [
<add> 'price' => 100,
<add> 'type' => 'car',
<add> ],
<add> [
<add> 'price' => 500,
<add> 'type' => 'boat',
<add> ],
<ide> ],
<add> ], [
<add> 'vehicles.0.wheels' => ['validation.required'],
<add> // vehicles.1.wheels is not required, because type is not "car"
<ide> ],
<del> ], [
<del> 'vehicles.0.wheels' => ['validation.required'],
<del> // vehicles.1.wheels is not required, because type is not "car"
<del> ],
<ide> ],
<ide> 'exclude-validation-error-01' => [
<ide> [
<ide> public function providesFailingExcludeIfData()
<ide> 'vehicles' => [
<ide> [
<ide> 'type' => 'car', 'wheels' => [
<del> ['color' => 'red', 'shape' => 'square'],
<del> ['color' => 'blue', 'shape' => 'hexagon'],
<del> ['color' => 'red', 'shape' => 'hexagon'],
<del> ['color' => 'blue', 'shape' => 'triangle'],
<del> ]
<add> ['color' => 'red', 'shape' => 'square'],
<add> ['color' => 'blue', 'shape' => 'hexagon'],
<add> ['color' => 'red', 'shape' => 'hexagon'],
<add> ['color' => 'blue', 'shape' => 'triangle'],
<add> ],
<ide> ],
<ide> ['type' => 'boat', 'wheels' => 'should be excluded'],
<ide> ], | 1 |
Ruby | Ruby | eliminate repeated work in formulary.factory | ca3688e33e1b98e67242e87a6b067b696f05effb | <ide><path>Library/Homebrew/formulary.rb
<ide> def get_formula
<ide> # * a formula URL
<ide> # * a local bottle reference
<ide> def self.factory ref
<del> # If a URL is passed, download to the cache and install
<del> if ref =~ %r[(https?|ftp)://]
<del> f = FromUrlLoader.new(ref)
<del> elsif ref =~ Pathname::BOTTLE_EXTNAME_RX
<del> f = BottleLoader.new(ref)
<del> else
<del> name_or_path = Formula.canonical_name(ref)
<del> if name_or_path =~ HOMEBREW_TAP_FORMULA_REGEX
<del> # name appears to be a tapped formula, so we don't munge it
<del> # in order to provide a useful error message when require fails.
<del> f = TapLoader.new(name_or_path)
<del> elsif name_or_path.include?("/") || File.extname(name_or_path) == ".rb"
<del> # If name was a path or mapped to a cached formula
<del> f = FromPathLoader.new(name_or_path)
<add> loader_for(ref).get_formula
<add> end
<add>
<add> def self.loader_for(ref)
<add> case ref
<add> when %r[(https?|ftp)://]
<add> return FromUrlLoader.new(ref)
<add> when Pathname::BOTTLE_EXTNAME_RX
<add> return BottleLoader.new(ref)
<add> end
<add>
<add> if ref =~ HOMEBREW_TAP_FORMULA_REGEX
<add> tap_name = "#$1-#$2".downcase
<add> tapd = Pathname.new("#{HOMEBREW_LIBRARY}/Taps/#{tap_name}")
<add>
<add> if tapd.directory?
<add> tapd.find_formula do |relative_pathname|
<add> path = "#{tapd}/#{relative_pathname}"
<add> if relative_pathname.stem.to_s == $3
<add> return FromPathLoader.new(path)
<add> end
<add> end
<ide> else
<del> f = StandardLoader.new(name_or_path)
<add> return TapLoader.new(ref)
<ide> end
<ide> end
<ide>
<del> f.get_formula
<add> if ref.include?("/") || File.extname(ref) == ".rb"
<add> return FromPathLoader.new(ref)
<add> end
<add>
<add> formula_with_that_name = Formula.path(ref)
<add> if formula_with_that_name.file? and formula_with_that_name.readable?
<add> return StandardLoader.new(ref)
<add> end
<add>
<add> # test if the name is a formula alias
<add> possible_alias = Pathname.new("#{HOMEBREW_LIBRARY}/Aliases/#{ref}")
<add> if possible_alias.file?
<add> name = possible_alias.resolved_path.basename(".rb").to_s
<add> return StandardLoader.new(name)
<add> end
<add>
<add> possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb")
<add> if possible_cached_formula.file?
<add> return FromPathLoader.new(possible_cached_formula.to_s)
<add> end
<add>
<add> return StandardLoader.new(ref)
<ide> end
<ide> end | 1 |
Text | Text | fix typo in documentation | 008c2d0b7aecfa53116346ffd8f8c51d38c59140 | <ide><path>examples/pytorch/translation/README.md
<ide> and you also will find examples of these below.
<ide> Here is an example of a translation fine-tuning with a MarianMT model:
<ide>
<ide> ```bash
<del>python examples/pytorch/seq2seq/run_translation.py \
<add>python examples/pytorch/translation/run_translation.py \
<ide> --model_name_or_path Helsinki-NLP/opus-mt-en-ro \
<ide> --do_train \
<ide> --do_eval \
<ide> MBart and some T5 models require special handling.
<ide> T5 models `t5-small`, `t5-base`, `t5-large`, `t5-3b` and `t5-11b` must use an additional argument: `--source_prefix "translate {source_lang} to {target_lang}"`. For example:
<ide>
<ide> ```bash
<del>python examples/pytorch/seq2seq/run_translation.py \
<add>python examples/pytorch/translation/run_translation.py \
<ide> --model_name_or_path t5-small \
<ide> --do_train \
<ide> --do_eval \
<ide> For the aforementioned group of T5 models it's important to remember that if you
<ide> MBart models require a different format for `--source_lang` and `--target_lang` values, e.g. instead of `en` it expects `en_XX`, for `ro` it expects `ro_RO`. The full MBart specification for language codes can be found [here](https://huggingface.co/facebook/mbart-large-cc25). For example:
<ide>
<ide> ```bash
<del>python examples/pytorch/seq2seq/run_translation.py \
<add>python examples/pytorch/translation/run_translation.py \
<ide> --model_name_or_path facebook/mbart-large-en-ro \
<ide> --do_train \
<ide> --do_eval \
<ide> And here is how you would use the translation finetuning on your own files, afte
<ide> values for the arguments `--train_file`, `--validation_file` to match your setup:
<ide>
<ide> ```bash
<del>python examples/pytorch/seq2seq/run_translation.py \
<add>python examples/pytorch/translation/run_translation.py \
<ide> --model_name_or_path t5-small \
<ide> --do_train \
<ide> --do_eval \
<ide> Here the languages are Romanian (`ro`) and English (`en`).
<ide> If you want to use a pre-processed dataset that leads to high BLEU scores, but for the `en-de` language pair, you can use `--dataset_name stas/wmt14-en-de-pre-processed`, as following:
<ide>
<ide> ```bash
<del>python examples/pytorch/seq2seq/run_translation.py \
<add>python examples/pytorch/translation/run_translation.py \
<ide> --model_name_or_path t5-small \
<ide> --do_train \
<ide> --do_eval \ | 1 |
Go | Go | fix rename error when sid is empty | b9ab129554084cf65b6ffcc89d09b5d82bc02459 | <ide><path>daemon/rename.go
<ide> func (daemon *Daemon) ContainerRename(oldName, newName string) error {
<ide> }()
<ide>
<ide> sid = container.NetworkSettings.SandboxID
<del> if daemon.netController != nil {
<add> if sid != "" && daemon.netController != nil {
<ide> sb, err = daemon.netController.SandboxByID(sid)
<ide> if err != nil {
<ide> return err | 1 |
Javascript | Javascript | remove some deprecated methods | 88ecb40f79cca1fc8881423672e50632aa4d4a04 | <ide><path>src/Three.Legacy.js
<ide> import { DataTextureLoader } from './loaders/DataTextureLoader.js';
<ide> import { TextureLoader } from './loaders/TextureLoader.js';
<ide> import { Material } from './materials/Material.js';
<ide> import { LineBasicMaterial } from './materials/LineBasicMaterial.js';
<del>import { MeshPhongMaterial } from './materials/MeshPhongMaterial.js';
<ide> import { MeshPhysicalMaterial } from './materials/MeshPhysicalMaterial.js';
<ide> import { PointsMaterial } from './materials/PointsMaterial.js';
<ide> import { ShaderMaterial } from './materials/ShaderMaterial.js';
<ide> import { Vector3 } from './math/Vector3.js';
<ide> import { Vector4 } from './math/Vector4.js';
<ide> import { Mesh } from './objects/Mesh.js';
<ide> import { LineSegments } from './objects/LineSegments.js';
<del>import { LOD } from './objects/LOD.js';
<ide> import { Points } from './objects/Points.js';
<ide> import { Sprite } from './objects/Sprite.js';
<del>import { Skeleton } from './objects/Skeleton.js';
<ide> import { SkinnedMesh } from './objects/SkinnedMesh.js';
<ide> import { WebGLRenderer } from './renderers/WebGLRenderer.js';
<ide> import { WebGLRenderTarget } from './renderers/WebGLRenderTarget.js';
<ide> Object.defineProperties( Mesh.prototype, {
<ide>
<ide> } );
<ide>
<del>Object.defineProperties( LOD.prototype, {
<del>
<del> objects: {
<del> get: function () {
<del>
<del> console.warn( 'THREE.LOD: .objects has been renamed to .levels.' );
<del> return this.levels;
<del>
<del> }
<del> }
<del>
<del>} );
<del>
<del>Object.defineProperty( Skeleton.prototype, 'useVertexTexture', {
<del>
<del> get: function () {
<del>
<del> console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
<del>
<del> },
<del> set: function () {
<del>
<del> console.warn( 'THREE.Skeleton: useVertexTexture has been removed.' );
<del>
<del> }
<del>
<del>} );
<del>
<ide> SkinnedMesh.prototype.initBones = function () {
<ide>
<ide> console.error( 'THREE.SkinnedMesh: initBones() has been removed.' );
<ide> Scene.prototype.dispose = function () {
<ide>
<ide> //
<ide>
<del>Object.defineProperties( Uniform.prototype, {
<del>
<del> dynamic: {
<del> set: function () {
<del>
<del> console.warn( 'THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.' );
<add>Uniform.prototype.onUpdate = function () {
<ide>
<del> }
<del> },
<del> onUpdate: {
<del> value: function () {
<del>
<del> console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );
<del> return this;
<del>
<del> }
<del> }
<add> console.warn( 'THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead.' );
<add> return this;
<ide>
<del>} );
<add>};
<ide>
<ide> //
<ide>
<ide> Object.defineProperties( Material.prototype, {
<ide>
<ide> } );
<ide>
<del>Object.defineProperties( MeshPhongMaterial.prototype, {
<del>
<del> metal: {
<del> get: function () {
<del>
<del> console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead.' );
<del> return false;
<del>
<del> },
<del> set: function () {
<del>
<del> console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead' );
<del>
<del> }
<del> }
<del>
<del>} );
<del>
<ide> Object.defineProperties( MeshPhysicalMaterial.prototype, {
<ide>
<ide> transparency: {
<ide> Object.defineProperties( WebGLRenderTarget.prototype, {
<ide>
<ide> //
<ide>
<del>Object.defineProperties( Audio.prototype, {
<del>
<del> load: {
<del> value: function ( file ) {
<add>Audio.prototype.load = function ( file ) {
<ide>
<del> console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
<del> const scope = this;
<del> const audioLoader = new AudioLoader();
<del> audioLoader.load( file, function ( buffer ) {
<add> console.warn( 'THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.' );
<add> const scope = this;
<add> const audioLoader = new AudioLoader();
<add> audioLoader.load( file, function ( buffer ) {
<ide>
<del> scope.setBuffer( buffer );
<del>
<del> } );
<del> return this;
<del>
<del> }
<del> },
<del> startTime: {
<del> set: function () {
<add> scope.setBuffer( buffer );
<ide>
<del> console.warn( 'THREE.Audio: .startTime is now .play( delay ).' );
<add> } );
<add> return this;
<ide>
<del> }
<del> }
<add>};
<ide>
<del>} );
<ide>
<ide> AudioAnalyser.prototype.getData = function () {
<ide> | 1 |
Go | Go | move dockerignore function to builder/dockerignore | 63e3816c1dd449de63500a2b5fec9c2a33a0894c | <ide><path>api/client/build.go
<ide> import (
<ide> "github.com/docker/distribution/reference"
<ide> "github.com/docker/docker/api"
<ide> "github.com/docker/docker/api/types"
<add> "github.com/docker/docker/builder/dockerignore"
<ide> Cli "github.com/docker/docker/cli"
<ide> "github.com/docker/docker/opts"
<ide> "github.com/docker/docker/pkg/archive"
<ide> func (cli *DockerCli) CmdBuild(args ...string) error {
<ide>
<ide> var excludes []string
<ide> if err == nil {
<del> excludes, err = utils.ReadDockerIgnore(f)
<add> excludes, err = dockerignore.ReadAll(f)
<ide> if err != nil {
<ide> return err
<ide> }
<ide><path>builder/dockerignore.go
<ide> package builder
<ide> import (
<ide> "os"
<ide>
<add> "github.com/docker/docker/builder/dockerignore"
<ide> "github.com/docker/docker/pkg/fileutils"
<del> "github.com/docker/docker/utils"
<ide> )
<ide>
<ide> // DockerIgnoreContext wraps a ModifiableContext to add a method
<ide> type DockerIgnoreContext struct {
<ide> // TODO: Don't require a ModifiableContext (use Context instead) and don't remove
<ide> // files, instead handle a list of files to be excluded from the context.
<ide> func (c DockerIgnoreContext) Process(filesToRemove []string) error {
<del> dockerignore, err := c.Open(".dockerignore")
<add> f, err := c.Open(".dockerignore")
<ide> // Note that a missing .dockerignore file isn't treated as an error
<ide> if err != nil {
<ide> if os.IsNotExist(err) {
<ide> return nil
<ide> }
<ide> return err
<ide> }
<del> excludes, _ := utils.ReadDockerIgnore(dockerignore)
<add> excludes, _ := dockerignore.ReadAll(f)
<ide> filesToRemove = append([]string{".dockerignore"}, filesToRemove...)
<ide> for _, fileToRemove := range filesToRemove {
<ide> rm, _ := fileutils.Matches(fileToRemove, excludes)
<ide><path>builder/dockerignore/dockerignore.go
<add>package dockerignore
<add>
<add>import (
<add> "bufio"
<add> "fmt"
<add> "io"
<add> "path/filepath"
<add> "strings"
<add>)
<add>
<add>// ReadAll reads a .dockerignore file and returns the list of file patterns
<add>// to ignore. Note this will trim whitespace from each line as well
<add>// as use GO's "clean" func to get the shortest/cleanest path for each.
<add>func ReadAll(reader io.ReadCloser) ([]string, error) {
<add> if reader == nil {
<add> return nil, nil
<add> }
<add> defer reader.Close()
<add> scanner := bufio.NewScanner(reader)
<add> var excludes []string
<add>
<add> for scanner.Scan() {
<add> pattern := strings.TrimSpace(scanner.Text())
<add> if pattern == "" {
<add> continue
<add> }
<add> pattern = filepath.Clean(pattern)
<add> excludes = append(excludes, pattern)
<add> }
<add> if err := scanner.Err(); err != nil {
<add> return nil, fmt.Errorf("Error reading .dockerignore: %v", err)
<add> }
<add> return excludes, nil
<add>}
<ide><path>builder/dockerignore/dockerignore_test.go
<add>package dockerignore
<add>
<add>import (
<add> "fmt"
<add> "io/ioutil"
<add> "os"
<add> "path/filepath"
<add> "testing"
<add>)
<add>
<add>func TestReadAll(t *testing.T) {
<add> tmpDir, err := ioutil.TempDir("", "dockerignore-test")
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> defer os.RemoveAll(tmpDir)
<add>
<add> di, err := ReadAll(nil)
<add> if err != nil {
<add> t.Fatalf("Expected not to have error, got %v", err)
<add> }
<add>
<add> if diLen := len(di); diLen != 0 {
<add> t.Fatalf("Expected to have zero dockerignore entry, got %d", diLen)
<add> }
<add>
<add> diName := filepath.Join(tmpDir, ".dockerignore")
<add> content := fmt.Sprintf("test1\n/test2\n/a/file/here\n\nlastfile")
<add> err = ioutil.WriteFile(diName, []byte(content), 0777)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> diFd, err := os.Open(diName)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add> di, err = ReadAll(diFd)
<add> if err != nil {
<add> t.Fatal(err)
<add> }
<add>
<add> if di[0] != "test1" {
<add> t.Fatalf("First element is not test1")
<add> }
<add> if di[1] != "/test2" {
<add> t.Fatalf("Second element is not /test2")
<add> }
<add> if di[2] != "/a/file/here" {
<add> t.Fatalf("Third element is not /a/file/here")
<add> }
<add> if di[3] != "lastfile" {
<add> t.Fatalf("Fourth element is not lastfile")
<add> }
<add>}
<ide><path>utils/utils.go
<ide> package utils
<ide>
<ide> import (
<del> "bufio"
<ide> "crypto/sha1"
<ide> "encoding/hex"
<ide> "fmt"
<ide> func ValidateContextDirectory(srcPath string, excludes []string) error {
<ide> })
<ide> }
<ide>
<del>// ReadDockerIgnore reads a .dockerignore file and returns the list of file patterns
<del>// to ignore. Note this will trim whitespace from each line as well
<del>// as use GO's "clean" func to get the shortest/cleanest path for each.
<del>func ReadDockerIgnore(reader io.ReadCloser) ([]string, error) {
<del> if reader == nil {
<del> return nil, nil
<del> }
<del> defer reader.Close()
<del> scanner := bufio.NewScanner(reader)
<del> var excludes []string
<del>
<del> for scanner.Scan() {
<del> pattern := strings.TrimSpace(scanner.Text())
<del> if pattern == "" {
<del> continue
<del> }
<del> pattern = filepath.Clean(pattern)
<del> excludes = append(excludes, pattern)
<del> }
<del> if err := scanner.Err(); err != nil {
<del> return nil, fmt.Errorf("Error reading .dockerignore: %v", err)
<del> }
<del> return excludes, nil
<del>}
<del>
<ide> // GetErrorMessage returns the human readable message associated with
<ide> // the passed-in error. In some cases the default Error() func returns
<ide> // something that is less than useful so based on its types this func
<ide><path>utils/utils_test.go
<ide> package utils
<ide>
<del>import (
<del> "fmt"
<del> "io/ioutil"
<del> "os"
<del> "path/filepath"
<del> "testing"
<del>)
<add>import "testing"
<ide>
<ide> func TestReplaceAndAppendEnvVars(t *testing.T) {
<ide> var (
<ide> func TestReplaceAndAppendEnvVars(t *testing.T) {
<ide> t.Fatalf("expected TERM=xterm got '%s'", env[1])
<ide> }
<ide> }
<del>
<del>func TestReadDockerIgnore(t *testing.T) {
<del> tmpDir, err := ioutil.TempDir("", "dockerignore-test")
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> defer os.RemoveAll(tmpDir)
<del>
<del> di, err := ReadDockerIgnore(nil)
<del> if err != nil {
<del> t.Fatalf("Expected not to have error, got %v", err)
<del> }
<del>
<del> if diLen := len(di); diLen != 0 {
<del> t.Fatalf("Expected to have zero dockerignore entry, got %d", diLen)
<del> }
<del>
<del> diName := filepath.Join(tmpDir, ".dockerignore")
<del> content := fmt.Sprintf("test1\n/test2\n/a/file/here\n\nlastfile")
<del> err = ioutil.WriteFile(diName, []byte(content), 0777)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> diFd, err := os.Open(diName)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del> di, err = ReadDockerIgnore(diFd)
<del> if err != nil {
<del> t.Fatal(err)
<del> }
<del>
<del> if di[0] != "test1" {
<del> t.Fatalf("First element is not test1")
<del> }
<del> if di[1] != "/test2" {
<del> t.Fatalf("Second element is not /test2")
<del> }
<del> if di[2] != "/a/file/here" {
<del> t.Fatalf("Third element is not /a/file/here")
<del> }
<del> if di[3] != "lastfile" {
<del> t.Fatalf("Fourth element is not lastfile")
<del> }
<del>} | 6 |
Text | Text | fix command in xlnet readme | 14a6c92e25538f0b463ac835d6745f4f60de8749 | <ide><path>official/nlp/xlnet/README.md
<ide> export IMDB_DIR=~/imdb
<ide> mkdir -p ${IMDB_DIR}
<ide>
<ide> cd ${IMDB_DIR}
<del>wget http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz .
<add>wget http://ai.stanford.edu/~amaas/data/sentiment/aclImdb_v1.tar.gz
<ide> tar zxvf aclImdb_v1.tar.gz -C ${IMDB_DIR}
<ide> rm aclImdb_v1.tar.gz
<ide> ```
<ide> Then, the dataset can be converted into TFRecords with the following command:
<ide> ```shell
<ide> export TASK_NAME=imdb
<ide>
<del>python3 preprocess_classification_data.py --max_seq_length=512 --spiece_model_file=${SPIECE_MODEL} --output_dir=${DATASETS_DIR}/${TASK_NAME} --data_dir=${IMDB_DIR} --task_name=${TASK_NAME}
<add>python3 preprocess_classification_data.py --max_seq_length=512 --spiece_model_file=${SPIECE_MODEL} --output_dir=${DATASETS_DIR}/${TASK_NAME} --data_dir=${IMDB_DIR}/aclImdb --task_name=${TASK_NAME}
<ide> ```
<ide>
<ide> Note: To obtain SOTA on the IMDB dataset, using a sequence length of 512 is | 1 |
Javascript | Javascript | make reactdom.createportal() official | 89508f20d49cde40d1083f7501fac388b86bbcb8 | <ide><path>src/renderers/__tests__/ReactUpdates-test.js
<ide> describe('ReactUpdates', () => {
<ide> var portal = null;
<ide> // If we're using Fiber, we use Portals instead to achieve this.
<ide> if (ReactDOMFeatureFlags.useFiber) {
<del> portal = ReactDOM.unstable_createPortal(
<del> <B ref={n => (b = n)} />,
<del> bContainer,
<del> );
<add> portal = ReactDOM.createPortal(<B ref={n => (b = n)} />, bContainer);
<ide> }
<ide> return <div>A{this.state.x}{portal}</div>;
<ide> }
<ide><path>src/renderers/dom/__tests__/ReactDOMProduction-test.js
<ide> describe('ReactDOMProduction', () => {
<ide> var expectSVG = {ref: el => svgEls.push(el)};
<ide> var expectHTML = {ref: el => htmlEls.push(el)};
<ide> var usePortal = function(tree) {
<del> return ReactDOM.unstable_createPortal(
<del> tree,
<del> document.createElement('div'),
<del> );
<add> return ReactDOM.createPortal(tree, document.createElement('div'));
<ide> };
<ide> var assertNamespacesMatch = function(tree) {
<ide> var container = document.createElement('div');
<ide><path>src/renderers/dom/fiber/ReactDOMFiberEntry.js
<ide> function renderSubtreeIntoContainer(
<ide> return DOMRenderer.getPublicRootInstance(root);
<ide> }
<ide>
<add>function createPortal(
<add> children: ReactNodeList,
<add> container: DOMContainer,
<add> key: ?string = null,
<add>) {
<add> invariant(
<add> isValidContainer(container),
<add> 'Target container is not a DOM element.',
<add> );
<add> // TODO: pass ReactDOM portal implementation as third argument
<add> return ReactPortal.createPortal(children, container, null, key);
<add>}
<add>
<ide> var ReactDOMFiber = {
<add> createPortal,
<add>
<ide> hydrate(element: React$Node, container: DOMContainer, callback: ?Function) {
<ide> // TODO: throw or warn if we couldn't hydrate?
<ide> return renderSubtreeIntoContainer(null, element, container, true, callback);
<ide> var ReactDOMFiber = {
<ide>
<ide> findDOMNode: findDOMNode,
<ide>
<del> unstable_createPortal(
<del> children: ReactNodeList,
<del> container: DOMContainer,
<del> key: ?string = null,
<del> ) {
<del> // TODO: pass ReactDOM portal implementation as third argument
<del> return ReactPortal.createPortal(children, container, null, key);
<del> },
<add> // Temporary alias since we already shipped React 16 RC with it.
<add> // TODO: remove in React 17.
<add> unstable_createPortal: createPortal,
<ide>
<ide> unstable_batchedUpdates: ReactGenericBatching.batchedUpdates,
<ide>
<ide><path>src/renderers/dom/fiber/__tests__/ReactDOMFiber-test.js
<ide> describe('ReactDOMFiber', () => {
<ide> var expectMath = {ref: el => mathEls.push(el)};
<ide>
<ide> var usePortal = function(tree) {
<del> return ReactDOM.unstable_createPortal(
<del> tree,
<del> document.createElement('div'),
<del> );
<add> return ReactDOM.createPortal(tree, document.createElement('div'));
<ide> };
<ide>
<ide> var assertNamespacesMatch = function(tree) {
<ide> describe('ReactDOMFiber', () => {
<ide> it('should render one portal', () => {
<ide> var portalContainer = document.createElement('div');
<ide>
<add> ReactDOM.render(
<add> <div>
<add> {ReactDOM.createPortal(<div>portal</div>, portalContainer)}
<add> </div>,
<add> container,
<add> );
<add> expect(portalContainer.innerHTML).toBe('<div>portal</div>');
<add> expect(container.innerHTML).toBe('<div></div>');
<add>
<add> ReactDOM.unmountComponentAtNode(container);
<add> expect(portalContainer.innerHTML).toBe('');
<add> expect(container.innerHTML).toBe('');
<add> });
<add>
<add> // TODO: remove in React 17
<add> it('should support unstable_createPortal alias', () => {
<add> var portalContainer = document.createElement('div');
<add>
<ide> ReactDOM.render(
<ide> <div>
<ide> {ReactDOM.unstable_createPortal(<div>portal</div>, portalContainer)}
<ide> describe('ReactDOMFiber', () => {
<ide> const {step} = this.props;
<ide> return [
<ide> <Child key="a" name={`normal[0]:${step}`} />,
<del> ReactDOM.unstable_createPortal(
<add> ReactDOM.createPortal(
<ide> <Child key="b" name={`portal1[0]:${step}`} />,
<ide> portalContainer1,
<ide> ),
<ide> <Child key="c" name={`normal[1]:${step}`} />,
<del> ReactDOM.unstable_createPortal(
<add> ReactDOM.createPortal(
<ide> [
<ide> <Child key="d" name={`portal2[0]:${step}`} />,
<ide> <Child key="e" name={`portal2[1]:${step}`} />,
<ide> describe('ReactDOMFiber', () => {
<ide> ReactDOM.render(
<ide> [
<ide> <div key="a">normal[0]</div>,
<del> ReactDOM.unstable_createPortal(
<add> ReactDOM.createPortal(
<ide> [
<ide> <div key="b">portal1[0]</div>,
<del> ReactDOM.unstable_createPortal(
<add> ReactDOM.createPortal(
<ide> <div key="c">portal2[0]</div>,
<ide> portalContainer2,
<ide> ),
<del> ReactDOM.unstable_createPortal(
<add> ReactDOM.createPortal(
<ide> <div key="d">portal3[0]</div>,
<ide> portalContainer3,
<ide> ),
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(<div>portal:1</div>, portalContainer)}
<add> {ReactDOM.createPortal(<div>portal:1</div>, portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(<div>portal:2</div>, portalContainer)}
<add> {ReactDOM.createPortal(<div>portal:2</div>, portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(<p>portal:3</p>, portalContainer)}
<add> {ReactDOM.createPortal(<p>portal:3</p>, portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(['Hi', 'Bye'], portalContainer)}
<add> {ReactDOM.createPortal(['Hi', 'Bye'], portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(['Bye', 'Hi'], portalContainer)}
<add> {ReactDOM.createPortal(['Bye', 'Hi'], portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div>
<del> {ReactDOM.unstable_createPortal(null, portalContainer)}
<add> {ReactDOM.createPortal(null, portalContainer)}
<ide> </div>,
<ide> container,
<ide> );
<ide> describe('ReactDOMFiber', () => {
<ide> }
<ide>
<ide> render() {
<del> return ReactDOM.unstable_createPortal(<Component />, portalContainer);
<add> return ReactDOM.createPortal(<Component />, portalContainer);
<ide> }
<ide> }
<ide>
<ide> describe('ReactDOMFiber', () => {
<ide> }
<ide>
<ide> render() {
<del> return ReactDOM.unstable_createPortal(<Component />, portalContainer);
<add> return ReactDOM.createPortal(<Component />, portalContainer);
<ide> }
<ide> }
<ide>
<ide> describe('ReactDOMFiber', () => {
<ide> }
<ide>
<ide> render() {
<del> return ReactDOM.unstable_createPortal(<Component />, portalContainer);
<add> return ReactDOM.createPortal(<Component />, portalContainer);
<ide> }
<ide> }
<ide>
<ide> describe('ReactDOMFiber', () => {
<ide>
<ide> ReactDOM.render(
<ide> <div onClick={() => ops.push('parent clicked')}>
<del> {ReactDOM.unstable_createPortal(
<add> {ReactDOM.createPortal(
<ide> <div
<ide> onClick={() => ops.push('portal clicked')}
<ide> ref={n => (portal = n)}>
<ide> describe('ReactDOMFiber', () => {
<ide> onMouseEnter={() => ops.push('enter parent')}
<ide> onMouseLeave={() => ops.push('leave parent')}>
<ide> <div ref={n => (firstTarget = n)} />
<del> {ReactDOM.unstable_createPortal(
<add> {ReactDOM.createPortal(
<ide> <div
<ide> onMouseEnter={() => ops.push('enter portal')}
<ide> onMouseLeave={() => ops.push('leave portal')}
<ide> describe('ReactDOMFiber', () => {
<ide> ]);
<ide> });
<ide>
<add> it('should throw on bad createPortal argument', () => {
<add> expect(() => {
<add> ReactDOM.createPortal(<div>portal</div>, null);
<add> }).toThrow('Target container is not a DOM element.');
<add> expect(() => {
<add> ReactDOM.createPortal(<div>portal</div>, document.createTextNode('hi'));
<add> }).toThrow('Target container is not a DOM element.');
<add> });
<add>
<ide> it('should warn for non-functional event listeners', () => {
<ide> spyOn(console, 'error');
<ide> class Example extends React.Component {
<ide><path>src/renderers/dom/shared/__tests__/renderSubtreeIntoContainer-test.js
<ide> describe('renderSubtreeIntoContainer', () => {
<ide> 'a React 15 tree inside a React 16 tree using ' +
<ide> "unstable_renderSubtreeIntoContainer, which isn't supported. Try to " +
<ide> 'make sure you have only one copy of React (and ideally, switch to ' +
<del> 'ReactDOM.unstable_createPortal).',
<add> 'ReactDOM.createPortal).',
<ide> );
<ide> });
<ide> }
<ide><path>src/renderers/native/ReactNativeFiberEntry.js
<ide> const ReactNativeFiber: ReactNativeType = {
<ide> UIManager.removeRootView(containerTag);
<ide> },
<ide>
<del> unstable_createPortal(
<add> createPortal(
<ide> children: ReactNodeList,
<ide> containerTag: number,
<ide> key: ?string = null,
<ide><path>src/renderers/shared/fiber/ReactFiberClassComponent.js
<ide> if (__DEV__) {
<ide> 'a React 15 tree inside a React 16 tree using ' +
<ide> "unstable_renderSubtreeIntoContainer, which isn't supported. Try " +
<ide> 'to make sure you have only one copy of React (and ideally, switch ' +
<del> 'to ReactDOM.unstable_createPortal).',
<add> 'to ReactDOM.createPortal).',
<ide> );
<ide> },
<ide> }); | 7 |
Ruby | Ruby | fix style issue | ac3ce218e3560713c44e856b2906be7e53a164e0 | <ide><path>Library/Homebrew/dev-cmd/man.rb
<ide> def cmd_comment_manpage_lines(cmd_path)
<ide>
<ide> sig { returns(String) }
<ide> def global_cask_options_manpage
<del> lines = ["These options are applicable to the `install`, `reinstall`, and `upgrade` subcommands with the `--cask` flag.\n"]
<add> lines = ["These options are applicable to the `install`, `reinstall`, and `upgrade` " \
<add> "subcommands with the `--cask` flag.\n"]
<ide> lines += Homebrew::CLI::Parser.global_cask_options.map do |_, long, description:, **|
<ide> generate_option_doc(nil, long.chomp("="), description)
<ide> end | 1 |
Mixed | Javascript | implement streams to webstreams adapters | a99c2303051ba8f694ac3bc3cb99998525d9e249 | <ide><path>doc/api/stream.md
<ide> Calling `Readable.from(string)` or `Readable.from(buffer)` will not have
<ide> the strings or buffers be iterated to match the other streams semantics
<ide> for performance reasons.
<ide>
<add>### `stream.Readable.fromWeb(readableStream[, options])`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `readableStream` {ReadableStream}
<add>* `options` {Object}
<add> * `encoding` {string}
<add> * `highWaterMark` {number}
<add> * `objectModel` {boolean}
<add> * `signal` {AbortSignal}
<add>* Returns: {stream.Readable}
<add>
<add>### `stream.Readable.toWeb(streamReadable)`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `streamReadable` {stream.Readable}
<add>* Returns: {ReadableStream}
<add>
<add>### `stream.Writable.fromWeb(writableStream[, options])`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `writableStream` {WritableStream}
<add>* `options` {Object}
<add> * `decodeStrings` {boolean}
<add> * `highWaterMark` {number}
<add> * `objectMode` {boolean}
<add> * `signal` {AbortSignal}
<add>* Returns: {stream.Writable}
<add>
<add>### `stream.Writable.toWeb(streamWritable)`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `streamWritable` {stream.Writable}
<add>* Returns: {WritableStream}
<add>
<add>### `stream.Duplex.fromWeb(pair[, options])`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `pair` {Object}
<add> * `readable` {ReadableStream}
<add> * `writable` {WritableStream}
<add>* `options` {Object}
<add> * `allowHalfOpen` {boolean}
<add> * `decodeStrings` {boolean}
<add> * `encoding` {string}
<add> * `highWaterMark` {number}
<add> * `objectMode` {boolean}
<add> * `signal` {AbortSignal}
<add>* Returns: {stream.Duplex}
<add>
<add>### `stream.Duplex.toWeb(streamDuplex)`
<add><!-- YAML
<add>added: REPLACEME
<add>-->
<add>
<add>> Stability: 1 - Experimental
<add>
<add>* `streamDuplex` {stream.Duplex}
<add>* Returns: {Object}
<add> * `readable` {ReadableStream}
<add> * `writable` {WritableStream}
<add>
<ide> ### `stream.addAbortSignal(signal, stream)`
<ide> <!-- YAML
<ide> added: v15.4.0
<ide><path>lib/internal/fs/promises.js
<ide> module.exports = {
<ide> appendFile,
<ide> readFile,
<ide> watch,
<add>
<add> kHandle,
<ide> },
<ide>
<ide> FileHandle,
<ide><path>lib/internal/streams/duplex.js
<ide> ObjectDefineProperties(Duplex.prototype, {
<ide> }
<ide> }
<ide> });
<add>
<add>let webStreamsAdapters;
<add>
<add>// Lazy to avoid circular references
<add>function lazyWebStreams() {
<add> if (webStreamsAdapters === undefined)
<add> webStreamsAdapters = require('internal/webstreams/adapters');
<add> return webStreamsAdapters;
<add>}
<add>
<add>Duplex.fromWeb = function(pair, options) {
<add> return lazyWebStreams().newStreamDuplexFromReadableWritablePair(
<add> pair,
<add> options);
<add>};
<add>
<add>Duplex.toWeb = function(duplex) {
<add> return lazyWebStreams().newReadableWritablePairFromDuplex(duplex);
<add>};
<ide><path>lib/internal/streams/readable.js
<ide> function endWritableNT(state, stream) {
<ide> Readable.from = function(iterable, opts) {
<ide> return from(Readable, iterable, opts);
<ide> };
<add>
<add>let webStreamsAdapters;
<add>
<add>// Lazy to avoid circular references
<add>function lazyWebStreams() {
<add> if (webStreamsAdapters === undefined)
<add> webStreamsAdapters = require('internal/webstreams/adapters');
<add> return webStreamsAdapters;
<add>}
<add>
<add>Readable.fromWeb = function(readableStream, options) {
<add> return lazyWebStreams().newStreamReadableFromReadableStream(
<add> readableStream,
<add> options);
<add>};
<add>
<add>Readable.toWeb = function(streamReadable) {
<add> return lazyWebStreams().newStreamReadableFromReadableStream(streamReadable);
<add>};
<ide><path>lib/internal/streams/writable.js
<ide> Writable.prototype._destroy = function(err, cb) {
<ide> Writable.prototype[EE.captureRejectionSymbol] = function(err) {
<ide> this.destroy(err);
<ide> };
<add>
<add>let webStreamsAdapters;
<add>
<add>// Lazy to avoid circular references
<add>function lazyWebStreams() {
<add> if (webStreamsAdapters === undefined)
<add> webStreamsAdapters = require('internal/webstreams/adapters');
<add> return webStreamsAdapters;
<add>}
<add>
<add>Writable.fromWeb = function(writableStream, options) {
<add> return lazyWebStreams().newStreamWritableFromWritableStream(
<add> writableStream,
<add> options);
<add>};
<add>
<add>Writable.toWeb = function(streamWritable) {
<add> return lazyWebStreams().newWritableStreamFromStreamWritable(streamWritable);
<add>};
<ide><path>lib/internal/webstreams/adapters.js
<add>'use strict';
<add>
<add>const {
<add> ArrayPrototypeMap,
<add> PromiseAll,
<add> PromisePrototypeThen,
<add> PromisePrototypeFinally,
<add> PromiseResolve,
<add> Uint8Array,
<add>} = primordials;
<add>
<add>const {
<add> ReadableStream,
<add> isReadableStream,
<add>} = require('internal/webstreams/readablestream');
<add>
<add>const {
<add> WritableStream,
<add> isWritableStream,
<add>} = require('internal/webstreams/writablestream');
<add>
<add>const {
<add> CountQueuingStrategy,
<add>} = require('internal/webstreams/queuingstrategies');
<add>
<add>const {
<add> Writable,
<add> Readable,
<add> Duplex,
<add> destroy,
<add>} = require('stream');
<add>
<add>const {
<add> isDestroyed,
<add> isReadable,
<add> isReadableEnded,
<add> isWritable,
<add> isWritableEnded,
<add>} = require('internal/streams/utils');
<add>
<add>const {
<add> Buffer,
<add>} = require('buffer');
<add>
<add>const {
<add> errnoException,
<add> codes: {
<add> ERR_INVALID_ARG_TYPE,
<add> ERR_INVALID_ARG_VALUE,
<add> ERR_INVALID_STATE,
<add> ERR_STREAM_PREMATURE_CLOSE,
<add> },
<add>} = require('internal/errors');
<add>
<add>const {
<add> createDeferredPromise,
<add>} = require('internal/util');
<add>
<add>const {
<add> validateBoolean,
<add> validateObject,
<add>} = require('internal/validators');
<add>
<add>const {
<add> WriteWrap,
<add> ShutdownWrap,
<add> kReadBytesOrError,
<add> kLastWriteWasAsync,
<add> streamBaseState,
<add>} = internalBinding('stream_wrap');
<add>
<add>const finished = require('internal/streams/end-of-stream');
<add>
<add>const { UV_EOF } = internalBinding('uv');
<add>
<add>/**
<add> * @typedef {import('../../stream').Writable} Writable
<add> * @typedef {import('../../stream').Readable} Readable
<add> * @typedef {import('./writablestream').WritableStream} WritableStream
<add> * @typedef {import('./readablestream').ReadableStream} ReadableStream
<add> *
<add> * @typedef {import('../abort_controller').AbortSignal} AbortSignal
<add> */
<add>
<add>/**
<add> * @param {Writable} streamWritable
<add> * @returns {WritableStream}
<add> */
<add>function newWritableStreamFromStreamWritable(streamWritable) {
<add> // Not using the internal/streams/utils isWritableNodeStream utility
<add> // here because it will return false if streamWritable is a Duplex
<add> // whose writable option is false. For a Duplex that is not writable,
<add> // we want it to pass this check but return a closed WritableStream.
<add> if (typeof streamWritable?._writableState !== 'object') {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'streamWritable',
<add> 'stream.Writable',
<add> streamWritable);
<add> }
<add>
<add> if (isDestroyed(streamWritable) || !isWritable(streamWritable)) {
<add> const writable = new WritableStream();
<add> writable.close();
<add> return writable;
<add> }
<add>
<add> const highWaterMark = streamWritable.writableHighWaterMark;
<add> const strategy =
<add> streamWritable.writableObjectMode ?
<add> new CountQueuingStrategy({ highWaterMark }) :
<add> { highWaterMark };
<add>
<add> let controller;
<add> let backpressurePromise;
<add> let closed;
<add>
<add> function onDrain() {
<add> if (backpressurePromise !== undefined)
<add> backpressurePromise.resolve();
<add> }
<add>
<add> const cleanup = finished(streamWritable, (error) => {
<add> cleanup();
<add> // This is a protection against non-standard, legacy streams
<add> // that happen to emit an error event again after finished is called.
<add> streamWritable.on('error', () => {});
<add> if (error != null) {
<add> if (backpressurePromise !== undefined)
<add> backpressurePromise.reject(error);
<add> // If closed is not undefined, the error is happening
<add> // after the WritableStream close has already started.
<add> // We need to reject it here.
<add> if (closed !== undefined) {
<add> closed.reject(error);
<add> closed = undefined;
<add> }
<add> controller.error(error);
<add> controller = undefined;
<add> return;
<add> }
<add>
<add> if (closed !== undefined) {
<add> closed.resolve();
<add> closed = undefined;
<add> return;
<add> }
<add> controller.error(new ERR_STREAM_PREMATURE_CLOSE());
<add> controller = undefined;
<add> });
<add>
<add> streamWritable.on('drain', onDrain);
<add>
<add> return new WritableStream({
<add> start(c) { controller = c; },
<add>
<add> async write(chunk) {
<add> if (streamWritable.writableNeedDrain || !streamWritable.write(chunk)) {
<add> backpressurePromise = createDeferredPromise();
<add> return PromisePrototypeFinally(
<add> backpressurePromise.promise, () => {
<add> backpressurePromise = undefined;
<add> });
<add> }
<add> },
<add>
<add> abort(reason) {
<add> destroy(streamWritable, reason);
<add> },
<add>
<add> close() {
<add> if (closed === undefined && !isWritableEnded(streamWritable)) {
<add> closed = createDeferredPromise();
<add> streamWritable.end();
<add> return closed.promise;
<add> }
<add>
<add> controller = undefined;
<add> return PromiseResolve();
<add> },
<add> }, strategy);
<add>}
<add>
<add>/**
<add> * @param {WritableStream} writableStream
<add> * @param {{
<add> * decodeStrings? : boolean,
<add> * highWaterMark? : number,
<add> * objectMode? : boolean,
<add> * signal? : AbortSignal,
<add> * }} [options]
<add> * @returns {Writable}
<add> */
<add>function newStreamWritableFromWritableStream(writableStream, options = {}) {
<add> if (!isWritableStream(writableStream)) {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'writableStream',
<add> 'WritableStream',
<add> writableStream);
<add> }
<add>
<add> validateObject(options, 'options');
<add> const {
<add> highWaterMark,
<add> decodeStrings = true,
<add> objectMode = false,
<add> signal,
<add> } = options;
<add>
<add> validateBoolean(objectMode, 'options.objectMode');
<add> validateBoolean(decodeStrings, 'options.decodeStrings');
<add>
<add> const writer = writableStream.getWriter();
<add> let closed = false;
<add>
<add> const writable = new Writable({
<add> highWaterMark,
<add> objectMode,
<add> decodeStrings,
<add> signal,
<add>
<add> writev(chunks, callback) {
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => destroy(writable, error));
<add> }
<add> }
<add>
<add> PromisePrototypeThen(
<add> writer.ready,
<add> () => {
<add> return PromisePrototypeThen(
<add> PromiseAll(
<add> ArrayPrototypeMap(
<add> chunks,
<add> (chunk) => writer.write(chunk))),
<add> done,
<add> done);
<add> },
<add> done);
<add> },
<add>
<add> write(chunk, encoding, callback) {
<add> if (typeof chunk === 'string' && decodeStrings && !objectMode) {
<add> chunk = Buffer.from(chunk, encoding);
<add> chunk = new Uint8Array(
<add> chunk.buffer,
<add> chunk.byteOffset,
<add> chunk.byteLength);
<add> }
<add>
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> destroy(writable, error);
<add> }
<add> }
<add>
<add> PromisePrototypeThen(
<add> writer.ready,
<add> () => {
<add> return PromisePrototypeThen(
<add> writer.write(chunk),
<add> done,
<add> done);
<add> },
<add> done);
<add> },
<add>
<add> destroy(error, callback) {
<add> function done() {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => { throw error; });
<add> }
<add> }
<add>
<add> if (!closed) {
<add> if (error != null) {
<add> PromisePrototypeThen(
<add> writer.abort(error),
<add> done,
<add> done);
<add> } else {
<add> PromisePrototypeThen(
<add> writer.close(),
<add> done,
<add> done);
<add> }
<add> return;
<add> }
<add>
<add> done();
<add> },
<add>
<add> final(callback) {
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => destroy(writable, error));
<add> }
<add> }
<add>
<add> if (!closed) {
<add> PromisePrototypeThen(
<add> writer.close(),
<add> done,
<add> done);
<add> }
<add> },
<add> });
<add>
<add> PromisePrototypeThen(
<add> writer.closed,
<add> () => {
<add> // If the WritableStream closes before the stream.Writable has been
<add> // ended, we signal an error on the stream.Writable.
<add> closed = true;
<add> if (!isWritableEnded(writable))
<add> destroy(writable, new ERR_STREAM_PREMATURE_CLOSE());
<add> },
<add> (error) => {
<add> // If the WritableStream errors before the stream.Writable has been
<add> // destroyed, signal an error on the stream.Writable.
<add> closed = true;
<add> destroy(writable, error);
<add> });
<add>
<add> return writable;
<add>}
<add>
<add>/**
<add> * @param {Readable} streamReadable
<add> * @returns {ReadableStream}
<add> */
<add>function newReadableStreamFromStreamReadable(streamReadable) {
<add> // Not using the internal/streams/utils isReadableNodeStream utility
<add> // here because it will return false if streamReadable is a Duplex
<add> // whose readable option is false. For a Duplex that is not readable,
<add> // we want it to pass this check but return a closed ReadableStream.
<add> if (typeof streamReadable?._readableState !== 'object') {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'streamReadable',
<add> 'stream.Readable',
<add> streamReadable);
<add> }
<add>
<add> if (isDestroyed(streamReadable) || !isReadable(streamReadable)) {
<add> const readable = new ReadableStream();
<add> readable.cancel();
<add> return readable;
<add> }
<add>
<add> const objectMode = streamReadable.readableObjectMode;
<add> const highWaterMark = streamReadable.readableHighWaterMark;
<add> // When not running in objectMode explicitly, we just fall
<add> // back to a minimal strategy that just specifies the highWaterMark
<add> // and no size algorithm. Using a ByteLengthQueuingStrategy here
<add> // is unnecessary.
<add> const strategy =
<add> objectMode ?
<add> new CountQueuingStrategy({ highWaterMark }) :
<add> { highWaterMark };
<add>
<add> let controller;
<add>
<add> function onData(chunk) {
<add> // Copy the Buffer to detach it from the pool.
<add> if (Buffer.isBuffer(chunk) && !objectMode)
<add> chunk = new Uint8Array(chunk);
<add> controller.enqueue(chunk);
<add> if (controller.desiredSize <= 0)
<add> streamReadable.pause();
<add> }
<add>
<add> streamReadable.pause();
<add>
<add> const cleanup = finished(streamReadable, (error) => {
<add> cleanup();
<add> // This is a protection against non-standard, legacy streams
<add> // that happen to emit an error event again after finished is called.
<add> streamReadable.on('error', () => {});
<add> if (error)
<add> return controller.error(error);
<add> controller.close();
<add> });
<add>
<add> streamReadable.on('data', onData);
<add>
<add> return new ReadableStream({
<add> start(c) { controller = c; },
<add>
<add> pull() { streamReadable.resume(); },
<add>
<add> cancel(reason) {
<add> destroy(streamReadable, reason);
<add> },
<add> }, strategy);
<add>}
<add>
<add>/**
<add> * @param {ReadableStream} readableStream
<add> * @param {{
<add> * highWaterMark? : number,
<add> * encoding? : string,
<add> * objectMode? : boolean,
<add> * signal? : AbortSignal,
<add> * }} [options]
<add> * @returns {Readable}
<add> */
<add>function newStreamReadableFromReadableStream(readableStream, options = {}) {
<add> if (!isReadableStream(readableStream)) {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'readableStream',
<add> 'ReadableStream',
<add> readableStream);
<add> }
<add>
<add> validateObject(options, 'options');
<add> const {
<add> highWaterMark,
<add> encoding,
<add> objectMode = false,
<add> signal,
<add> } = options;
<add>
<add> if (encoding !== undefined && !Buffer.isEncoding(encoding))
<add> throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
<add> validateBoolean(objectMode, 'options.objectMode');
<add>
<add> const reader = readableStream.getReader();
<add> let closed = false;
<add>
<add> const readable = new Readable({
<add> objectMode,
<add> highWaterMark,
<add> encoding,
<add> signal,
<add>
<add> read() {
<add> PromisePrototypeThen(
<add> reader.read(),
<add> (chunk) => {
<add> if (chunk.done) {
<add> // Value should always be undefined here.
<add> readable.push(null);
<add> } else {
<add> readable.push(chunk.value);
<add> }
<add> },
<add> (error) => destroy(readable, error));
<add> },
<add>
<add> destroy(error, callback) {
<add> function done() {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => { throw error; });
<add> }
<add> }
<add>
<add> if (!closed) {
<add> PromisePrototypeThen(
<add> reader.cancel(error),
<add> done,
<add> done);
<add> return;
<add> }
<add> done(error);
<add> },
<add> });
<add>
<add> PromisePrototypeThen(
<add> reader.closed,
<add> () => {
<add> closed = true;
<add> if (!isReadableEnded(readable))
<add> readable.push(null);
<add> },
<add> (error) => {
<add> closed = true;
<add> destroy(readable, error);
<add> });
<add>
<add> return readable;
<add>}
<add>
<add>/**
<add> * @typedef {import('./readablestream').ReadableWritablePair
<add> * } ReadableWritablePair
<add> * @typedef {import('../../stream').Duplex} Duplex
<add> *
<add> * @param {Duplex} duplex
<add> * @returns {ReadableWritablePair}
<add> */
<add>function newReadableWritablePairFromDuplex(duplex) {
<add> // Not using the internal/streams/utils isWritableNodeStream and
<add> // isReadableNodestream utilities here because they will return false
<add> // if the duplex was created with writable or readable options set to
<add> // false. Instead, we'll check the readable and writable state after
<add> // and return closed WritableStream or closed ReadableStream as
<add> // necessary.
<add> if (typeof duplex?._writableState !== 'object' ||
<add> typeof duplex?._readableState !== 'object') {
<add> throw new ERR_INVALID_ARG_TYPE('duplex', 'stream.Duplex', duplex);
<add> }
<add>
<add> if (isDestroyed(duplex)) {
<add> const writable = new WritableStream();
<add> const readable = new ReadableStream();
<add> writable.close();
<add> readable.cancel();
<add> return { readable, writable };
<add> }
<add>
<add> const writable =
<add> isWritable(duplex) ?
<add> newWritableStreamFromStreamWritable(duplex) :
<add> new WritableStream();
<add>
<add> if (!isWritable(duplex))
<add> writable.close();
<add>
<add> const readable =
<add> isReadable(duplex) ?
<add> newReadableStreamFromStreamReadable(duplex) :
<add> new ReadableStream();
<add>
<add> if (!isReadable(duplex))
<add> readable.cancel();
<add>
<add> return { writable, readable };
<add>}
<add>
<add>/**
<add> * @param {ReadableWritablePair} pair
<add> * @param {{
<add> * allowHalfOpen? : boolean,
<add> * decodeStrings? : boolean,
<add> * encoding? : string,
<add> * highWaterMark? : number,
<add> * objectMode? : boolean,
<add> * signal? : AbortSignal,
<add> * }} [options]
<add> * @returns
<add> */
<add>function newStreamDuplexFromReadableWritablePair(pair = {}, options = {}) {
<add> validateObject(pair, 'pair');
<add> const {
<add> readable: readableStream,
<add> writable: writableStream,
<add> } = pair;
<add>
<add> if (!isReadableStream(readableStream)) {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'pair.readable',
<add> 'ReadableStream',
<add> readableStream);
<add> }
<add> if (!isWritableStream(writableStream)) {
<add> throw new ERR_INVALID_ARG_TYPE(
<add> 'pair.writable',
<add> 'WritableStream',
<add> writableStream);
<add> }
<add>
<add> validateObject(options, 'options');
<add> const {
<add> allowHalfOpen = false,
<add> objectMode = false,
<add> encoding,
<add> decodeStrings = true,
<add> highWaterMark,
<add> signal,
<add> } = options;
<add>
<add> validateBoolean(objectMode, 'options.objectMode');
<add> if (encoding !== undefined && !Buffer.isEncoding(encoding))
<add> throw new ERR_INVALID_ARG_VALUE(encoding, 'options.encoding');
<add>
<add> const writer = writableStream.getWriter();
<add> const reader = readableStream.getReader();
<add> let writableClosed = false;
<add> let readableClosed = false;
<add>
<add> const duplex = new Duplex({
<add> allowHalfOpen,
<add> highWaterMark,
<add> objectMode,
<add> encoding,
<add> decodeStrings,
<add> signal,
<add>
<add> writev(chunks, callback) {
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => destroy(duplex, error));
<add> }
<add> }
<add>
<add> PromisePrototypeThen(
<add> writer.ready,
<add> () => {
<add> return PromisePrototypeThen(
<add> PromiseAll(
<add> ArrayPrototypeMap(
<add> chunks,
<add> (chunk) => writer.write(chunk))),
<add> done,
<add> done);
<add> },
<add> done);
<add> },
<add>
<add> write(chunk, encoding, callback) {
<add> if (typeof chunk === 'string' && decodeStrings && !objectMode) {
<add> chunk = Buffer.from(chunk, encoding);
<add> chunk = new Uint8Array(
<add> chunk.buffer,
<add> chunk.byteOffset,
<add> chunk.byteLength);
<add> }
<add>
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> destroy(duplex, error);
<add> }
<add> }
<add>
<add> PromisePrototypeThen(
<add> writer.ready,
<add> () => {
<add> return PromisePrototypeThen(
<add> writer.write(chunk),
<add> done,
<add> done);
<add> },
<add> done);
<add> },
<add>
<add> final(callback) {
<add> function done(error) {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => destroy(duplex, error));
<add> }
<add> }
<add>
<add> if (!writableClosed) {
<add> PromisePrototypeThen(
<add> writer.close(),
<add> done,
<add> done);
<add> }
<add> },
<add>
<add> read() {
<add> PromisePrototypeThen(
<add> reader.read(),
<add> (chunk) => {
<add> if (chunk.done) {
<add> duplex.push(null);
<add> } else {
<add> duplex.push(chunk.value);
<add> }
<add> },
<add> (error) => destroy(duplex, error));
<add> },
<add>
<add> destroy(error, callback) {
<add> function done() {
<add> try {
<add> callback(error);
<add> } catch (error) {
<add> // In a next tick because this is happening within
<add> // a promise context, and if there are any errors
<add> // thrown we don't want those to cause an unhandled
<add> // rejection. Let's just escape the promise and
<add> // handle it separately.
<add> process.nextTick(() => { throw error; });
<add> }
<add> }
<add>
<add> async function closeWriter() {
<add> if (!writableClosed)
<add> await writer.abort(error);
<add> }
<add>
<add> async function closeReader() {
<add> if (!readableClosed)
<add> await reader.cancel(error);
<add> }
<add>
<add> if (!writableClosed || !readableClosed) {
<add> PromisePrototypeThen(
<add> PromiseAll([
<add> closeWriter(),
<add> closeReader(),
<add> ]),
<add> done,
<add> done);
<add> return;
<add> }
<add>
<add> done();
<add> },
<add> });
<add>
<add> PromisePrototypeThen(
<add> writer.closed,
<add> () => {
<add> writableClosed = true;
<add> if (!isWritableEnded(duplex))
<add> destroy(duplex, new ERR_STREAM_PREMATURE_CLOSE());
<add> },
<add> (error) => {
<add> writableClosed = true;
<add> readableClosed = true;
<add> destroy(duplex, error);
<add> });
<add>
<add> PromisePrototypeThen(
<add> reader.closed,
<add> () => {
<add> readableClosed = true;
<add> if (!isReadableEnded(duplex))
<add> duplex.push(null);
<add> },
<add> (error) => {
<add> writableClosed = true;
<add> readableClosed = true;
<add> destroy(duplex, error);
<add> });
<add>
<add> return duplex;
<add>}
<add>
<add>/**
<add> * @typedef {import('./queuingstrategies').QueuingStrategy} QueuingStrategy
<add> * @typedef {{}} StreamBase
<add> * @param {StreamBase} streamBase
<add> * @param {QueuingStrategy} strategy
<add> * @returns {WritableStream}
<add> */
<add>function newWritableStreamFromStreamBase(streamBase, strategy) {
<add> validateObject(streamBase, 'streamBase');
<add>
<add> let current;
<add>
<add> function createWriteWrap(controller, promise) {
<add> const req = new WriteWrap();
<add> req.handle = streamBase;
<add> req.oncomplete = onWriteComplete;
<add> req.async = false;
<add> req.bytes = 0;
<add> req.buffer = null;
<add> req.controller = controller;
<add> req.promise = promise;
<add> return req;
<add> }
<add>
<add> function onWriteComplete(status) {
<add> if (status < 0) {
<add> const error = errnoException(status, 'write', this.error);
<add> this.promise.reject(error);
<add> this.controller.error(error);
<add> return;
<add> }
<add> this.promise.resolve();
<add> }
<add>
<add> function doWrite(chunk, controller) {
<add> const promise = createDeferredPromise();
<add> let ret;
<add> let req;
<add> try {
<add> req = createWriteWrap(controller, promise);
<add> ret = streamBase.writeBuffer(req, chunk);
<add> if (streamBaseState[kLastWriteWasAsync])
<add> req.buffer = chunk;
<add> req.async = !!streamBaseState[kLastWriteWasAsync];
<add> } catch (error) {
<add> promise.reject(error);
<add> }
<add>
<add> if (ret !== 0)
<add> promise.reject(errnoException(ret, 'write', req));
<add> else if (!req.async)
<add> promise.resolve();
<add>
<add> return promise.promise;
<add> }
<add>
<add> return new WritableStream({
<add> write(chunk, controller) {
<add> current = current !== undefined ?
<add> PromisePrototypeThen(
<add> current,
<add> () => doWrite(chunk, controller),
<add> (error) => controller.error(error)) :
<add> doWrite(chunk, controller);
<add> return current;
<add> },
<add>
<add> close() {
<add> const promise = createDeferredPromise();
<add> const req = new ShutdownWrap();
<add> req.oncomplete = () => promise.resolve();
<add> const err = streamBase.shutdown(req);
<add> if (err === 1)
<add> promise.resolve();
<add> return promise.promise;
<add> },
<add> }, strategy);
<add>}
<add>
<add>/**
<add> * @param {StreamBase} streamBase
<add> * @param {QueuingStrategy} strategy
<add> * @returns {ReadableStream}
<add> */
<add>function newReadableStreamFromStreamBase(streamBase, strategy) {
<add> validateObject(streamBase, 'streamBase');
<add>
<add> if (typeof streamBase.onread === 'function')
<add> throw new ERR_INVALID_STATE('StreamBase already has a consumer');
<add>
<add> let controller;
<add>
<add> streamBase.onread = (arrayBuffer) => {
<add> const nread = streamBaseState[kReadBytesOrError];
<add>
<add> if (nread === 0)
<add> return;
<add>
<add> try {
<add> if (nread === UV_EOF) {
<add> controller.close();
<add> streamBase.readStop();
<add> return;
<add> }
<add>
<add> controller.enqueue(arrayBuffer);
<add>
<add> if (controller.desiredSize <= 0)
<add> streamBase.readStop();
<add> } catch (error) {
<add> controller.error(error);
<add> streamBase.readStop();
<add> }
<add> };
<add>
<add> return new ReadableStream({
<add> start(c) { controller = c; },
<add>
<add> pull() {
<add> streamBase.readStart();
<add> },
<add>
<add> cancel() {
<add> const promise = createDeferredPromise();
<add> const req = new ShutdownWrap();
<add> req.oncomplete = () => promise.resolve();
<add> const err = streamBase.shutdown(req);
<add> if (err === 1)
<add> promise.resolve();
<add> return promise.promise;
<add> },
<add> }, strategy);
<add>}
<add>
<add>module.exports = {
<add> newWritableStreamFromStreamWritable,
<add> newReadableStreamFromStreamReadable,
<add> newStreamWritableFromWritableStream,
<add> newStreamReadableFromReadableStream,
<add> newReadableWritablePairFromDuplex,
<add> newStreamDuplexFromReadableWritablePair,
<add> newWritableStreamFromStreamBase,
<add> newReadableStreamFromStreamBase,
<add>};
<ide><path>test/parallel/test-whatwg-webstreams-adapters-streambase.js
<add>// Flags: --expose-internals --no-warnings
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> internalBinding,
<add>} = require('internal/test/binding');
<add>
<add>const {
<add> newWritableStreamFromStreamBase,
<add> newReadableStreamFromStreamBase,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> JSStream
<add>} = internalBinding('js_stream');
<add>
<add>{
<add> const stream = new JSStream();
<add> stream.onwrite = common.mustCall((req, buf) => {
<add> assert.deepStrictEqual(buf[0], Buffer.from('hello'));
<add> req.oncomplete();
<add> });
<add>
<add> const writable = newWritableStreamFromStreamBase(stream);
<add>
<add> const writer = writable.getWriter();
<add>
<add> writer.write(Buffer.from('hello')).then(common.mustCall());
<add>}
<add>
<add>{
<add> const buf = Buffer.from('hello');
<add> const check = new Uint8Array(buf);
<add>
<add> const stream = new JSStream();
<add>
<add> const readable = newReadableStreamFromStreamBase(stream);
<add>
<add> const reader = readable.getReader();
<add>
<add> reader.read().then(common.mustCall(({ done, value }) => {
<add> assert(!done);
<add> assert.deepStrictEqual(new Uint8Array(value), check);
<add>
<add> reader.read().then(common.mustCall(({ done, value }) => {
<add> assert(done);
<add> assert.strictEqual(value, undefined);
<add> }));
<add>
<add> }));
<add>
<add> stream.readBuffer(buf);
<add> stream.emitEOF();
<add>}
<add>
<add>{
<add> const stream = new JSStream();
<add> stream.onshutdown = common.mustCall((req) => {
<add> req.oncomplete();
<add> });
<add> const readable = newReadableStreamFromStreamBase(stream);
<add> readable.cancel().then(common.mustCall());
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-readablestream.js
<add>// Flags: --no-warnings --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> newReadableStreamFromStreamReadable,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> Duplex,
<add> Readable,
<add>} = require('stream');
<add>
<add>const {
<add> kState,
<add>} = require('internal/webstreams/util');
<add>
<add>{
<add> // Canceling the readableStream closes the readable.
<add> const readable = new Readable({
<add> read() {
<add> readable.push('hello');
<add> readable.push(null);
<add> }
<add> });
<add>
<add> readable.on('close', common.mustCall());
<add> readable.on('end', common.mustNotCall());
<add> readable.on('pause', common.mustCall());
<add> readable.on('resume', common.mustNotCall());
<add> readable.on('error', common.mustCall((error) => {
<add> assert.strictEqual(error.code, 'ABORT_ERR');
<add> }));
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add>
<add> readableStream.cancel().then(common.mustCall());
<add>}
<add>
<add>{
<add> // Prematurely destroying the stream.Readable without an error
<add> // closes the ReadableStream with a premature close error but does
<add> // not error the readable.
<add>
<add> const readable = new Readable({
<add> read() {
<add> readable.push('hello');
<add> readable.push(null);
<add> }
<add> });
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add>
<add> assert(!readableStream.locked);
<add>
<add> const reader = readableStream.getReader();
<add>
<add> assert.rejects(reader.closed, {
<add> code: 'ERR_STREAM_PREMATURE_CLOSE',
<add> });
<add>
<add> readable.on('end', common.mustNotCall());
<add> readable.on('error', common.mustNotCall());
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'errored');
<add> }));
<add>
<add> readable.destroy();
<add>}
<add>
<add>{
<add> // Ending the readable without an error just closes the
<add> // readableStream without an error.
<add> const readable = new Readable({
<add> read() {
<add> readable.push('hello');
<add> readable.push(null);
<add> }
<add> });
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add>
<add> assert(!readableStream.locked);
<add>
<add> const reader = readableStream.getReader();
<add>
<add> reader.closed.then(common.mustCall());
<add>
<add> readable.on('end', common.mustCall());
<add> readable.on('error', common.mustNotCall());
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'closed');
<add> }));
<add>
<add> readable.push(null);
<add>}
<add>
<add>{
<add> // Destroying the readable with an error should error the readableStream
<add> const error = new Error('boom');
<add> const readable = new Readable({
<add> read() {
<add> readable.push('hello');
<add> readable.push(null);
<add> }
<add> });
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add>
<add> assert(!readableStream.locked);
<add>
<add> const reader = readableStream.getReader();
<add>
<add> assert.rejects(reader.closed, error);
<add>
<add> readable.on('end', common.mustNotCall());
<add> readable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'errored');
<add> }));
<add>
<add> readable.destroy(error);
<add>}
<add>
<add>{
<add> const readable = new Readable({
<add> encoding: 'utf8',
<add> read() {
<add> readable.push('hello');
<add> readable.push(null);
<add> }
<add> });
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add> const reader = readableStream.getReader();
<add>
<add> readable.on('data', common.mustCall());
<add> readable.on('end', common.mustCall());
<add> readable.on('close', common.mustCall());
<add>
<add> (async () => {
<add> assert.deepStrictEqual(
<add> await reader.read(),
<add> { value: 'hello', done: false });
<add> assert.deepStrictEqual(
<add> await reader.read(),
<add> { value: undefined, done: true });
<add>
<add> })().then(common.mustCall());
<add>}
<add>
<add>{
<add> const data = {};
<add> const readable = new Readable({
<add> objectMode: true,
<add> read() {
<add> readable.push(data);
<add> readable.push(null);
<add> }
<add> });
<add>
<add> assert(readable.readableObjectMode);
<add>
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add> const reader = readableStream.getReader();
<add>
<add> readable.on('data', common.mustCall());
<add> readable.on('end', common.mustCall());
<add> readable.on('close', common.mustCall());
<add>
<add> (async () => {
<add> assert.deepStrictEqual(
<add> await reader.read(),
<add> { value: data, done: false });
<add> assert.deepStrictEqual(
<add> await reader.read(),
<add> { value: undefined, done: true });
<add>
<add> })().then(common.mustCall());
<add>}
<add>
<add>{
<add> const readable = new Readable();
<add> readable.destroy();
<add> const readableStream = newReadableStreamFromStreamReadable(readable);
<add> const reader = readableStream.getReader();
<add> reader.closed.then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new Duplex({ readable: false });
<add> duplex.destroy();
<add> const readableStream = newReadableStreamFromStreamReadable(duplex);
<add> const reader = readableStream.getReader();
<add> reader.closed.then(common.mustCall());
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-readablewritablepair.js
<add>// Flags: --no-warnings --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> newReadableWritablePairFromDuplex,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> PassThrough,
<add>} = require('stream');
<add>
<add>{
<add> // Destroying the duplex without an error should close
<add> // the readable and error the writable.
<add>
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> assert.rejects(reader.closed, {
<add> code: 'ERR_STREAM_PREMATURE_CLOSE',
<add> });
<add>
<add> assert.rejects(writer.closed, {
<add> code: 'ERR_STREAM_PREMATURE_CLOSE',
<add> });
<add>
<add> duplex.destroy();
<add>
<add> duplex.on('close', common.mustCall());
<add>}
<add>
<add>{
<add> // Destroying the duplex with an error should error
<add> // both the readable and writable
<add>
<add> const error = new Error('boom');
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add> duplex.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> assert.rejects(reader.closed, error);
<add> assert.rejects(writer.closed, error);
<add>
<add> duplex.destroy(error);
<add>}
<add>
<add>{
<add> const error = new Error('boom');
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add> duplex.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> reader.closed.then(common.mustCall());
<add> assert.rejects(writer.closed, error);
<add>
<add> reader.cancel(error).then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add> duplex.on('error', common.mustNotCall());
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> reader.closed.then(common.mustCall());
<add> writer.closed.then(common.mustCall());
<add>
<add> writer.close().then(common.mustCall());
<add>}
<add>
<add>{
<add> const error = new Error('boom');
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add> duplex.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> assert.rejects(reader.closed, error);
<add> assert.rejects(writer.closed, error);
<add>
<add> writer.abort(error).then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add>
<add> duplex.on('error', common.mustCall((error) => {
<add> assert.strictEqual(error.code, 'ABORT_ERR');
<add> }));
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> assert.rejects(writer.closed, {
<add> code: 'ABORT_ERR',
<add> });
<add>
<add> reader.cancel();
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('close', common.mustCall());
<add> duplex.on('error', common.mustNotCall());
<add>
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add>
<add> reader.closed.then(common.mustCall());
<add> assert.rejects(writer.closed, {
<add> code: 'ERR_STREAM_PREMATURE_CLOSE',
<add> });
<add>
<add> duplex.end();
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add>
<add> duplex.on('data', common.mustCall(2));
<add> duplex.on('close', common.mustCall());
<add> duplex.on('end', common.mustCall());
<add> duplex.on('finish', common.mustCall());
<add>
<add> const writer = writable.getWriter();
<add> const reader = readable.getReader();
<add>
<add> const ec = new TextEncoder();
<add> const dc = new TextDecoder();
<add>
<add> Promise.all([
<add> writer.write(ec.encode('hello')),
<add> reader.read().then(common.mustCall(({ done, value }) => {
<add> assert(!done);
<add> assert.strictEqual(dc.decode(value), 'hello');
<add> })),
<add> reader.read().then(common.mustCall(({ done, value }) => {
<add> assert(!done);
<add> assert.strictEqual(dc.decode(value), 'there');
<add> })),
<add> writer.write(ec.encode('there')),
<add> writer.close(),
<add> reader.read().then(common.mustCall(({ done, value }) => {
<add> assert(done);
<add> assert.strictEqual(value, undefined);
<add> })),
<add> ]).then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> duplex.destroy();
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add> reader.closed.then(common.mustCall());
<add> writer.closed.then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new PassThrough({ writable: false });
<add> assert(duplex.readable);
<add> assert(!duplex.writable);
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add> writer.closed.then(common.mustCall());
<add> reader.cancel().then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new PassThrough({ readable: false });
<add> assert(!duplex.readable);
<add> assert(duplex.writable);
<add> const {
<add> readable,
<add> writable,
<add> } = newReadableWritablePairFromDuplex(duplex);
<add> const reader = readable.getReader();
<add> const writer = writable.getWriter();
<add> reader.closed.then(common.mustCall());
<add> writer.close().then(common.mustCall());
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-streamduplex.js
<add>// Flags: --no-warnings --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> TransformStream,
<add>} = require('stream/web');
<add>
<add>const {
<add> newStreamDuplexFromReadableWritablePair,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> finished,
<add> pipeline,
<add> Readable,
<add> Writable,
<add>} = require('stream');
<add>
<add>const {
<add> kState,
<add>} = require('internal/webstreams/util');
<add>
<add>{
<add> const transform = new TransformStream();
<add> const duplex = newStreamDuplexFromReadableWritablePair(transform);
<add>
<add> assert(transform.readable.locked);
<add> assert(transform.writable.locked);
<add>
<add> duplex.destroy();
<add>
<add> duplex.on('close', common.mustCall(() => {
<add> assert.strictEqual(transform.readable[kState].state, 'closed');
<add> assert.strictEqual(transform.writable[kState].state, 'errored');
<add> }));
<add>}
<add>
<add>{
<add> const error = new Error('boom');
<add> const transform = new TransformStream();
<add> const duplex = newStreamDuplexFromReadableWritablePair(transform);
<add>
<add> assert(transform.readable.locked);
<add> assert(transform.writable.locked);
<add>
<add> duplex.destroy(error);
<add> duplex.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> duplex.on('close', common.mustCall(() => {
<add> assert.strictEqual(transform.readable[kState].state, 'closed');
<add> assert.strictEqual(transform.writable[kState].state, 'errored');
<add> assert.strictEqual(transform.writable[kState].storedError, error);
<add> }));
<add>}
<add>
<add>{
<add> const transform = new TransformStream();
<add> const duplex = new newStreamDuplexFromReadableWritablePair(transform);
<add>
<add> duplex.end();
<add> duplex.resume();
<add>
<add> duplex.on('close', common.mustCall(() => {
<add> assert.strictEqual(transform.readable[kState].state, 'closed');
<add> assert.strictEqual(transform.writable[kState].state, 'closed');
<add> }));
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const dc = new TextDecoder();
<add> const transform = new TransformStream({
<add> transform(chunk, controller) {
<add> const text = dc.decode(chunk);
<add> controller.enqueue(ec.encode(text.toUpperCase()));
<add> }
<add> });
<add> const duplex = new newStreamDuplexFromReadableWritablePair(transform, {
<add> encoding: 'utf8',
<add> });
<add>
<add> duplex.end('hello');
<add> duplex.on('data', common.mustCall((chunk) => {
<add> assert.strictEqual(chunk, 'HELLO');
<add> }));
<add> duplex.on('end', common.mustCall());
<add>
<add> duplex.on('close', common.mustCall(() => {
<add> assert.strictEqual(transform.readable[kState].state, 'closed');
<add> assert.strictEqual(transform.writable[kState].state, 'closed');
<add> }));
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const dc = new TextDecoder();
<add> const transform = new TransformStream({
<add> transform: common.mustCall((chunk, controller) => {
<add> const text = dc.decode(chunk);
<add> controller.enqueue(ec.encode(text.toUpperCase()));
<add> })
<add> });
<add> const duplex = new newStreamDuplexFromReadableWritablePair(transform, {
<add> encoding: 'utf8',
<add> });
<add>
<add> finished(duplex, common.mustCall());
<add>
<add> duplex.end('hello');
<add> duplex.resume();
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const dc = new TextDecoder();
<add> const transform = new TransformStream({
<add> transform: common.mustCall((chunk, controller) => {
<add> const text = dc.decode(chunk);
<add> controller.enqueue(ec.encode(text.toUpperCase()));
<add> })
<add> });
<add> const duplex = new newStreamDuplexFromReadableWritablePair(transform, {
<add> encoding: 'utf8',
<add> });
<add>
<add> const readable = new Readable({
<add> read() {
<add> readable.push(Buffer.from('hello'));
<add> readable.push(null);
<add> }
<add> });
<add>
<add> const writable = new Writable({
<add> write: common.mustCall((chunk, encoding, callback) => {
<add> assert.strictEqual(dc.decode(chunk), 'HELLO');
<add> assert.strictEqual(encoding, 'buffer');
<add> callback();
<add> })
<add> });
<add>
<add> finished(duplex, common.mustCall());
<add> pipeline(readable, duplex, writable, common.mustCall());
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-streamreadable.js
<add>// Flags: --expose-internals --no-warnings
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> pipeline,
<add> finished,
<add> Writable,
<add>} = require('stream');
<add>
<add>const {
<add> ReadableStream,
<add> WritableStream,
<add>} = require('stream/web');
<add>
<add>const {
<add> newStreamReadableFromReadableStream,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> kState,
<add>} = require('internal/webstreams/util');
<add>
<add>class MySource {
<add> constructor(value = new Uint8Array(10)) {
<add> this.value = value;
<add> }
<add>
<add> start(c) {
<add> this.started = true;
<add> this.controller = c;
<add> }
<add>
<add> pull(controller) {
<add> controller.enqueue(this.value);
<add> controller.close();
<add> }
<add>
<add> cancel(reason) {
<add> this.canceled = true;
<add> this.cancelReason = reason;
<add> }
<add>}
<add>
<add>{
<add> // Destroying the readable without an error closes
<add> // the readableStream.
<add>
<add> const readableStream = new ReadableStream();
<add> const readable = newStreamReadableFromReadableStream(readableStream);
<add>
<add> assert(readableStream.locked);
<add>
<add> assert.rejects(readableStream.cancel(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add> assert.rejects(readableStream.pipeTo(new WritableStream()), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add> assert.throws(() => readableStream.tee(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add> assert.throws(() => readableStream.getReader(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add> assert.throws(() => {
<add> readableStream.pipeThrough({
<add> readable: new ReadableStream(),
<add> writable: new WritableStream(),
<add> });
<add> }, {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add>
<add> readable.destroy();
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'closed');
<add> }));
<add>}
<add>
<add>{
<add> // Destroying the readable with an error closes the readableStream
<add> // without error but records the cancel reason in the source.
<add> const error = new Error('boom');
<add> const source = new MySource();
<add> const readableStream = new ReadableStream(source);
<add> const readable = newStreamReadableFromReadableStream(readableStream);
<add>
<add> assert(readableStream.locked);
<add>
<add> readable.destroy(error);
<add>
<add> readable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'closed');
<add> assert.strictEqual(source.cancelReason, error);
<add> }));
<add>}
<add>
<add>{
<add> // An error in the source causes the readable to error.
<add> const error = new Error('boom');
<add> const source = new MySource();
<add> const readableStream = new ReadableStream(source);
<add> const readable = newStreamReadableFromReadableStream(readableStream);
<add>
<add> assert(readableStream.locked);
<add>
<add> source.controller.error(error);
<add>
<add> readable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> readable.on('close', common.mustCall(() => {
<add> assert.strictEqual(readableStream[kState].state, 'errored');
<add> }));
<add>}
<add>
<add>{
<add> const readableStream = new ReadableStream(new MySource());
<add> const readable = newStreamReadableFromReadableStream(readableStream);
<add>
<add> readable.on('data', common.mustCall((chunk) => {
<add> assert.deepStrictEqual(chunk, Buffer.alloc(10));
<add> }));
<add> readable.on('end', common.mustCall());
<add> readable.on('close', common.mustCall());
<add> readable.on('error', common.mustNotCall());
<add>}
<add>
<add>{
<add> const readableStream = new ReadableStream(new MySource('hello'));
<add> const readable = newStreamReadableFromReadableStream(readableStream, {
<add> encoding: 'utf8',
<add> });
<add>
<add> readable.on('data', common.mustCall((chunk) => {
<add> assert.deepStrictEqual(chunk, 'hello');
<add> }));
<add> readable.on('end', common.mustCall());
<add> readable.on('close', common.mustCall());
<add> readable.on('error', common.mustNotCall());
<add>}
<add>
<add>{
<add> const readableStream = new ReadableStream(new MySource());
<add> const readable = newStreamReadableFromReadableStream(readableStream, {
<add> objectMode: true
<add> });
<add>
<add> readable.on('data', common.mustCall((chunk) => {
<add> assert.deepStrictEqual(chunk, new Uint8Array(10));
<add> }));
<add> readable.on('end', common.mustCall());
<add> readable.on('close', common.mustCall());
<add> readable.on('error', common.mustNotCall());
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const readable = new ReadableStream({
<add> start(controller) {
<add> controller.enqueue(ec.encode('hello'));
<add> setImmediate(() => {
<add> controller.enqueue(ec.encode('there'));
<add> controller.close();
<add> });
<add> }
<add> });
<add> const streamReadable = newStreamReadableFromReadableStream(readable);
<add>
<add> finished(streamReadable, common.mustCall());
<add>
<add> streamReadable.resume();
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const readable = new ReadableStream({
<add> start(controller) {
<add> controller.enqueue(ec.encode('hello'));
<add> setImmediate(() => {
<add> controller.enqueue(ec.encode('there'));
<add> controller.close();
<add> });
<add> }
<add> });
<add> const streamReadable = newStreamReadableFromReadableStream(readable);
<add>
<add> finished(streamReadable, common.mustCall());
<add>
<add> streamReadable.resume();
<add>}
<add>
<add>{
<add> const ec = new TextEncoder();
<add> const dc = new TextDecoder();
<add> const check = ['hello', 'there'];
<add> const readable = new ReadableStream({
<add> start(controller) {
<add> controller.enqueue(ec.encode('hello'));
<add> setImmediate(() => {
<add> controller.enqueue(ec.encode('there'));
<add> controller.close();
<add> });
<add> }
<add> });
<add> const writable = new Writable({
<add> write: common.mustCall((chunk, encoding, callback) => {
<add> assert.strictEqual(dc.decode(chunk), check.shift());
<add> assert.strictEqual(encoding, 'buffer');
<add> callback();
<add> }, 2),
<add> });
<add>
<add> const streamReadable = newStreamReadableFromReadableStream(readable);
<add>
<add> pipeline(streamReadable, writable, common.mustCall());
<add>
<add> streamReadable.resume();
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-streamwritable.js
<add>// Flags: --no-warnings --expose-internals
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> WritableStream,
<add>} = require('stream/web');
<add>
<add>const {
<add> newStreamWritableFromWritableStream,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> finished,
<add> pipeline,
<add> Readable,
<add>} = require('stream');
<add>
<add>const {
<add> kState,
<add>} = require('internal/webstreams/util');
<add>
<add>class TestSource {
<add> constructor() {
<add> this.chunks = [];
<add> }
<add>
<add> start(c) {
<add> this.controller = c;
<add> this.started = true;
<add> }
<add>
<add> write(chunk) {
<add> this.chunks.push(chunk);
<add> }
<add>
<add> close() {
<add> this.closed = true;
<add> }
<add>
<add> abort(reason) {
<add> this.abortReason = reason;
<add> }
<add>}
<add>
<add>[1, {}, false, []].forEach((arg) => {
<add> assert.throws(() => newStreamWritableFromWritableStream(arg), {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> });
<add>});
<add>
<add>{
<add> // Ending the stream.Writable should close the writableStream
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> assert(writableStream.locked);
<add>
<add> writable.end('chunk');
<add>
<add> writable.on('close', common.mustCall(() => {
<add> assert(writableStream.locked);
<add> assert.strictEqual(writableStream[kState].state, 'closed');
<add> assert.strictEqual(source.chunks.length, 1);
<add> assert.deepStrictEqual(source.chunks[0], Buffer.from('chunk'));
<add> }));
<add>}
<add>
<add>{
<add> // Destroying the stream.Writable without an error should close
<add> // the writableStream with no error.
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> assert(writableStream.locked);
<add>
<add> writable.destroy();
<add>
<add> writable.on('close', common.mustCall(() => {
<add> assert(writableStream.locked);
<add> assert.strictEqual(writableStream[kState].state, 'closed');
<add> assert.strictEqual(source.chunks.length, 0);
<add> }));
<add>}
<add>
<add>{
<add> // Destroying the stream.Writable with an error should error
<add> // the writableStream
<add> const error = new Error('boom');
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> assert(writableStream.locked);
<add>
<add> writable.destroy(error);
<add>
<add> writable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add>
<add> writable.on('close', common.mustCall(() => {
<add> assert(writableStream.locked);
<add> assert.strictEqual(writableStream[kState].state, 'errored');
<add> assert.strictEqual(writableStream[kState].storedError, error);
<add> assert.strictEqual(source.chunks.length, 0);
<add> }));
<add>}
<add>
<add>{
<add> // Attempting to close, abort, or getWriter on writableStream
<add> // should fail because it is locked. An internal error in
<add> // writableStream should error the writable.
<add> const error = new Error('boom');
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> assert(writableStream.locked);
<add>
<add> assert.rejects(writableStream.close(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add>
<add> assert.rejects(writableStream.abort(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add>
<add> assert.throws(() => writableStream.getWriter(), {
<add> code: 'ERR_INVALID_STATE',
<add> });
<add>
<add> writable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(error, reason);
<add> }));
<add>
<add> source.controller.error(error);
<add>}
<add>
<add>{
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> writable.on('error', common.mustNotCall());
<add> writable.on('finish', common.mustCall());
<add> writable.on('close', common.mustCall(() => {
<add> assert.strictEqual(source.chunks.length, 1);
<add> assert.deepStrictEqual(source.chunks[0], Buffer.from('hello'));
<add> }));
<add>
<add> writable.write('hello', common.mustCall());
<add> writable.end();
<add>}
<add>
<add>{
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable =
<add> newStreamWritableFromWritableStream(writableStream, {
<add> decodeStrings: false,
<add> });
<add>
<add> writable.on('error', common.mustNotCall());
<add> writable.on('finish', common.mustCall());
<add> writable.on('close', common.mustCall(() => {
<add> assert.strictEqual(source.chunks.length, 1);
<add> assert.deepStrictEqual(source.chunks[0], 'hello');
<add> }));
<add>
<add> writable.write('hello', common.mustCall());
<add> writable.end();
<add>}
<add>
<add>{
<add> const source = new TestSource();
<add> const writableStream = new WritableStream(source);
<add> const writable =
<add> newStreamWritableFromWritableStream(
<add> writableStream, {
<add> objectMode: true
<add> });
<add> assert(writable.writableObjectMode);
<add>
<add> writable.on('error', common.mustNotCall());
<add> writable.on('finish', common.mustCall());
<add> writable.on('close', common.mustCall(() => {
<add> assert.strictEqual(source.chunks.length, 1);
<add> assert.strictEqual(source.chunks[0], 'hello');
<add> }));
<add>
<add> writable.write('hello', common.mustCall());
<add> writable.end();
<add>}
<add>
<add>{
<add> const writableStream = new WritableStream({
<add> write: common.mustCall(2),
<add> close: common.mustCall(),
<add> });
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> finished(writable, common.mustCall());
<add>
<add> writable.write('hello');
<add> writable.write('world');
<add> writable.end();
<add>}
<add>
<add>{
<add> const writableStream = new WritableStream({
<add> write: common.mustCall(2),
<add> close: common.mustCall(),
<add> });
<add> const writable = newStreamWritableFromWritableStream(writableStream);
<add>
<add> const readable = new Readable({
<add> read() {
<add> readable.push(Buffer.from('hello'));
<add> readable.push(Buffer.from('world'));
<add> readable.push(null);
<add> }
<add> });
<add>
<add> pipeline(readable, writable, common.mustCall());
<add>}
<ide><path>test/parallel/test-whatwg-webstreams-adapters-to-writablestream.js
<add>// Flags: --no-warnings --expose-internals
<add>
<add>'use strict';
<add>
<add>const common = require('../common');
<add>
<add>const assert = require('assert');
<add>
<add>const {
<add> newWritableStreamFromStreamWritable,
<add>} = require('internal/webstreams/adapters');
<add>
<add>const {
<add> Duplex,
<add> Writable,
<add> PassThrough,
<add>} = require('stream');
<add>
<add>class TestWritable extends Writable {
<add> constructor(asyncWrite = false) {
<add> super();
<add> this.chunks = [];
<add> this.asyncWrite = asyncWrite;
<add> }
<add>
<add> _write(chunk, encoding, callback) {
<add> this.chunks.push({ chunk, encoding });
<add> if (this.asyncWrite) {
<add> setImmediate(() => callback());
<add> return;
<add> }
<add> callback();
<add> }
<add>}
<add>
<add>[1, {}, false, []].forEach((arg) => {
<add> assert.throws(() => newWritableStreamFromStreamWritable(arg), {
<add> code: 'ERR_INVALID_ARG_TYPE',
<add> });
<add>});
<add>
<add>{
<add> // Closing the WritableStream normally closes the stream.Writable
<add> // without errors.
<add>
<add> const writable = new TestWritable();
<add> writable.on('error', common.mustNotCall());
<add> writable.on('finish', common.mustCall());
<add> writable.on('close', common.mustCall());
<add>
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add>
<add> writableStream.close().then(common.mustCall(() => {
<add> assert(writable.destroyed);
<add> }));
<add>}
<add>
<add>{
<add> // Aborting the WritableStream errors the stream.Writable
<add>
<add> const error = new Error('boom');
<add> const writable = new TestWritable();
<add> writable.on('error', common.mustCall((reason) => {
<add> assert.strictEqual(reason, error);
<add> }));
<add> writable.on('finish', common.mustNotCall());
<add> writable.on('close', common.mustCall());
<add>
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add>
<add> writableStream.abort(error).then(common.mustCall(() => {
<add> assert(writable.destroyed);
<add> }));
<add>}
<add>
<add>{
<add> // Destroying the stream.Writable prematurely errors the
<add> // WritableStream
<add>
<add> const error = new Error('boom');
<add> const writable = new TestWritable();
<add>
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add> assert.rejects(writableStream.close(), error);
<add> writable.destroy(error);
<add>}
<add>
<add>{
<add> // Ending the stream.Writable directly errors the WritableStream
<add> const writable = new TestWritable();
<add>
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add>
<add> assert.rejects(writableStream.close(), {
<add> code: 'ERR_STREAM_PREMATURE_CLOSE'
<add> });
<add>
<add> writable.end();
<add>}
<add>
<add>{
<add> const writable = new TestWritable();
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add> const writer = writableStream.getWriter();
<add> const ec = new TextEncoder();
<add> writer.write(ec.encode('hello')).then(common.mustCall(() => {
<add> assert.strictEqual(writable.chunks.length, 1);
<add> assert.deepStrictEqual(
<add> writable.chunks[0],
<add> {
<add> chunk: Buffer.from('hello'),
<add> encoding: 'buffer'
<add> });
<add> }));
<add>}
<add>
<add>{
<add> const writable = new TestWritable(true);
<add>
<add> writable.on('error', common.mustNotCall());
<add> writable.on('close', common.mustCall());
<add> writable.on('finish', common.mustCall());
<add>
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add> const writer = writableStream.getWriter();
<add> const ec = new TextEncoder();
<add> writer.write(ec.encode('hello')).then(common.mustCall(() => {
<add> assert.strictEqual(writable.chunks.length, 1);
<add> assert.deepStrictEqual(
<add> writable.chunks[0],
<add> {
<add> chunk: Buffer.from('hello'),
<add> encoding: 'buffer'
<add> });
<add> writer.close().then(common.mustCall());
<add> }));
<add>}
<add>
<add>{
<add> const duplex = new PassThrough();
<add> duplex.setEncoding('utf8');
<add> const writableStream = newWritableStreamFromStreamWritable(duplex);
<add> const ec = new TextEncoder();
<add> writableStream
<add> .getWriter()
<add> .write(ec.encode('hello'))
<add> .then(common.mustCall());
<add>
<add> duplex.on('data', common.mustCall((chunk) => {
<add> assert.strictEqual(chunk, 'hello');
<add> }));
<add>}
<add>
<add>{
<add> const writable = new Writable();
<add> writable.destroy();
<add> const writableStream = newWritableStreamFromStreamWritable(writable);
<add> const writer = writableStream.getWriter();
<add> writer.closed.then(common.mustCall());
<add>}
<add>
<add>{
<add> const duplex = new Duplex({ writable: false });
<add> const writableStream = newWritableStreamFromStreamWritable(duplex);
<add> const writer = writableStream.getWriter();
<add> writer.closed.then(common.mustCall());
<add>} | 13 |
Python | Python | remove old model command (now "vocab") | affd3404ab24b5143ba97b26c40a90dc4b1dcbc0 | <ide><path>spacy/__main__.py
<ide> if __name__ == '__main__':
<ide> import plac
<ide> import sys
<del> from spacy.cli import download, link, info, package, train, convert, model
<add> from spacy.cli import download, link, info, package, train, convert
<ide> from spacy.cli import vocab, profile, evaluate, validate
<ide> from spacy.util import prints
<ide>
<ide> 'evaluate': evaluate,
<ide> 'convert': convert,
<ide> 'package': package,
<del> 'model': model,
<ide> 'vocab': vocab,
<ide> 'profile': profile,
<ide> 'validate': validate
<ide><path>spacy/cli/__init__.py
<ide> from .train import train
<ide> from .evaluate import evaluate
<ide> from .convert import convert
<del>from .model import model
<ide> from .vocab import make_vocab as vocab
<ide> from .validate import validate
<ide><path>spacy/cli/model.py
<del># coding: utf8
<del>from __future__ import unicode_literals
<del>
<del>try:
<del> import bz2
<del> import gzip
<del>except ImportError:
<del> pass
<del>import math
<del>from ast import literal_eval
<del>from pathlib import Path
<del>
<del>import numpy as np
<del>import spacy
<del>from preshed.counter import PreshCounter
<del>
<del>from .. import util
<del>from ..compat import fix_text
<del>
<del>
<del>def model(cmd, lang, model_dir, freqs_data, clusters_data, vectors_data,
<del> min_doc_freq=5, min_word_freq=200):
<del> model_path = Path(model_dir)
<del> freqs_path = Path(freqs_data)
<del> clusters_path = Path(clusters_data) if clusters_data else None
<del> vectors_path = Path(vectors_data) if vectors_data else None
<del>
<del> check_dirs(freqs_path, clusters_path, vectors_path)
<del> vocab = util.get_lang_class(lang).Defaults.create_vocab()
<del> nlp = spacy.blank(lang)
<del> vocab = nlp.vocab
<del> probs, oov_prob = read_probs(
<del> freqs_path, min_doc_freq=int(min_doc_freq), min_freq=int(min_doc_freq))
<del> clusters = read_clusters(clusters_path) if clusters_path else {}
<del> populate_vocab(vocab, clusters, probs, oov_prob)
<del> add_vectors(vocab, vectors_path)
<del> create_model(model_path, nlp)
<del>
<del>
<del>def add_vectors(vocab, vectors_path):
<del> with bz2.BZ2File(vectors_path.as_posix()) as f:
<del> num_words, dim = next(f).split()
<del> vocab.clear_vectors(int(dim))
<del> for line in f:
<del> word_w_vector = line.decode("utf8").strip().split(" ")
<del> word = word_w_vector[0]
<del> vector = np.array([float(val) for val in word_w_vector[1:]])
<del> if word in vocab:
<del> vocab.set_vector(word, vector)
<del>
<del>
<del>def create_model(model_path, model):
<del> if not model_path.exists():
<del> model_path.mkdir()
<del> model.to_disk(model_path.as_posix())
<del>
<del>
<del>def read_probs(freqs_path, max_length=100, min_doc_freq=5, min_freq=200):
<del> counts = PreshCounter()
<del> total = 0
<del> freqs_file = check_unzip(freqs_path)
<del> for i, line in enumerate(freqs_file):
<del> freq, doc_freq, key = line.rstrip().split('\t', 2)
<del> freq = int(freq)
<del> counts.inc(i + 1, freq)
<del> total += freq
<del> counts.smooth()
<del> log_total = math.log(total)
<del> freqs_file = check_unzip(freqs_path)
<del> probs = {}
<del> for line in freqs_file:
<del> freq, doc_freq, key = line.rstrip().split('\t', 2)
<del> doc_freq = int(doc_freq)
<del> freq = int(freq)
<del> if doc_freq >= min_doc_freq and freq >= min_freq and len(
<del> key) < max_length:
<del> word = literal_eval(key)
<del> smooth_count = counts.smoother(int(freq))
<del> probs[word] = math.log(smooth_count) - log_total
<del> oov_prob = math.log(counts.smoother(0)) - log_total
<del> return probs, oov_prob
<del>
<del>
<del>def read_clusters(clusters_path):
<del> clusters = {}
<del> with clusters_path.open() as f:
<del> for line in f:
<del> try:
<del> cluster, word, freq = line.split()
<del> word = fix_text(word)
<del> except ValueError:
<del> continue
<del> # If the clusterer has only seen the word a few times, its
<del> # cluster is unreliable.
<del> if int(freq) >= 3:
<del> clusters[word] = cluster
<del> else:
<del> clusters[word] = '0'
<del> # Expand clusters with re-casing
<del> for word, cluster in list(clusters.items()):
<del> if word.lower() not in clusters:
<del> clusters[word.lower()] = cluster
<del> if word.title() not in clusters:
<del> clusters[word.title()] = cluster
<del> if word.upper() not in clusters:
<del> clusters[word.upper()] = cluster
<del> return clusters
<del>
<del>
<del>def populate_vocab(vocab, clusters, probs, oov_prob):
<del> for word, prob in reversed(
<del> sorted(list(probs.items()), key=lambda item: item[1])):
<del> lexeme = vocab[word]
<del> lexeme.prob = prob
<del> lexeme.is_oov = False
<del> # Decode as a little-endian string, so that we can do & 15 to get
<del> # the first 4 bits. See _parse_features.pyx
<del> if word in clusters:
<del> lexeme.cluster = int(clusters[word][::-1], 2)
<del> else:
<del> lexeme.cluster = 0
<del>
<del>
<del>def check_unzip(file_path):
<del> file_path_str = file_path.as_posix()
<del> if file_path_str.endswith('gz'):
<del> return gzip.open(file_path_str)
<del> else:
<del> return file_path.open()
<del>
<del>
<del>def check_dirs(freqs_data, clusters_data, vectors_data):
<del> if not freqs_data.is_file():
<del> util.sys_exit(freqs_data.as_posix(), title="No frequencies file found")
<del> if clusters_data and not clusters_data.is_file():
<del> util.sys_exit(
<del> clusters_data.as_posix(), title="No Brown clusters file found")
<del> if vectors_data and not vectors_data.is_file():
<del> util.sys_exit(
<del> vectors_data.as_posix(), title="No word vectors file found") | 3 |
Javascript | Javascript | add agent.maxfreesockets option | 65f6f06a61c36630ee405a697b1d876208212874 | <ide><path>lib/_http_agent.js
<ide> function Agent(options) {
<ide> self.keepAliveMsecs = self.options.keepAliveMsecs || 1000;
<ide> self.keepAlive = self.options.keepAlive || false;
<ide> self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets;
<add> self.maxFreeSockets = self.options.maxFreeSockets || 256;
<ide>
<ide> self.on('free', function(socket, options) {
<ide> var name = self.getName(options);
<ide> function Agent(options) {
<ide> !socket.destroyed &&
<ide> self.options.keepAlive) {
<ide> var freeSockets = self.freeSockets[name];
<del> var count = freeSockets ? freeSockets.length : 0;
<add> var freeLen = freeSockets ? freeSockets.length : 0;
<add> var count = freeLen;
<ide> if (self.sockets[name])
<ide> count += self.sockets[name].length;
<ide>
<del> if (count > self.maxSockets) {
<add> if (count >= self.maxSockets || freeLen >= self.maxFreeSockets) {
<add> self.removeSocket(socket, options);
<ide> socket.destroy();
<ide> } else {
<ide> freeSockets = freeSockets || [];
<ide> self.freeSockets[name] = freeSockets;
<ide> socket.setKeepAlive(true, self.keepAliveMsecs);
<ide> socket.unref();
<ide> socket._httpMessage = null;
<add> self.removeSocket(socket, options);
<ide> freeSockets.push(socket);
<ide> }
<ide> } else {
<add> self.removeSocket(socket, options);
<ide> socket.destroy();
<ide> }
<ide> }
<ide> Agent.prototype.addRequest = function(req, options) {
<ide> this.sockets[name] = [];
<ide> }
<ide>
<del> if (this.freeSockets[name] && this.freeSockets[name].length) {
<del> debug('have free socket');
<add> var freeLen = this.freeSockets[name] ? this.freeSockets[name].length : 0;
<add> var sockLen = freeLen + this.sockets[name].length;
<add>
<add> if (freeLen) {
<ide> // we have a free socket, so use that.
<ide> var socket = this.freeSockets[name].shift();
<add> debug('have free socket');
<ide>
<ide> // don't leak
<ide> if (!this.freeSockets[name].length)
<ide> delete this.freeSockets[name];
<ide>
<ide> socket.ref();
<ide> req.onSocket(socket);
<del> } else if (this.sockets[name].length < this.maxSockets) {
<del> debug('call onSocket');
<add> this.sockets[name].push(socket);
<add> } else if (sockLen < this.maxSockets) {
<add> debug('call onSocket', sockLen, freeLen);
<ide> // If we are under maxSockets create a new one.
<ide> req.onSocket(this.createSocket(req, options));
<ide> } else {
<ide><path>test/simple/test-http-keepalive-maxsockets.js
<add>// Copyright Joyent, Inc. and other Node contributors.
<add>//
<add>// Permission is hereby granted, free of charge, to any person obtaining a
<add>// copy of this software and associated documentation files (the
<add>// "Software"), to deal in the Software without restriction, including
<add>// without limitation the rights to use, copy, modify, merge, publish,
<add>// distribute, sublicense, and/or sell copies of the Software, and to permit
<add>// persons to whom the Software is furnished to do so, subject to the
<add>// following conditions:
<add>//
<add>// The above copyright notice and this permission notice shall be included
<add>// in all copies or substantial portions of the Software.
<add>//
<add>// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<add>// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<add>// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
<add>// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
<add>// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
<add>// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
<add>// USE OR OTHER DEALINGS IN THE SOFTWARE.
<add>
<add>var common = require('../common');
<add>var assert = require('assert');
<add>
<add>var http = require('http');
<add>
<add>
<add>var serverSockets = [];
<add>var server = http.createServer(function(req, res) {
<add> if (serverSockets.indexOf(req.socket) === -1) {
<add> serverSockets.push(req.socket);
<add> }
<add> res.end(req.url);
<add>});
<add>server.listen(common.PORT);
<add>
<add>var agent = http.Agent({
<add> keepAlive: true,
<add> maxSockets: 5,
<add> maxFreeSockets: 2
<add>});
<add>
<add>// make 10 requests in parallel,
<add>// then 10 more when they all finish.
<add>function makeReqs(n, cb) {
<add> for (var i = 0; i < n; i++)
<add> makeReq(i, then)
<add>
<add> function then(er) {
<add> if (er)
<add> return cb(er);
<add> else if (--n === 0)
<add> setTimeout(cb);
<add> }
<add>}
<add>
<add>function makeReq(i, cb) {
<add> agent.request({ port: common.PORT, path: '/' + i }, function(res) {
<add> var data = '';
<add> res.setEncoding('ascii');
<add> res.on('data', function(c) {
<add> data += c;
<add> });
<add> res.on('end', function() {
<add> assert.equal(data, '/' + i);
<add> cb();
<add> });
<add> }).end();
<add>}
<add>
<add>var closed = false;
<add>makeReqs(10, function(er) {
<add> assert.ifError(er);
<add> assert.equal(count(agent.freeSockets), 2);
<add> assert.equal(count(agent.sockets), 0);
<add> assert.equal(serverSockets.length, 5);
<add>
<add> // now make 10 more reqs.
<add> // should use the 2 free reqs from the pool first.
<add> makeReqs(10, function(er) {
<add> assert.ifError(er);
<add> assert.equal(count(agent.freeSockets), 2);
<add> assert.equal(count(agent.sockets), 0);
<add> assert.equal(serverSockets.length, 8);
<add>
<add> agent.destroy();
<add> server.close(function() {
<add> closed = true;
<add> });
<add> });
<add>});
<add>
<add>function count(sockets) {
<add> return Object.keys(sockets).reduce(function(n, name) {
<add> return n + sockets[name].length;
<add> }, 0);
<add>}
<add>
<add>process.on('exit', function() {
<add> assert(closed);
<add> console.log('ok');
<add>}); | 2 |
Javascript | Javascript | fix eol issue in messages on windows | 2c42999f7e0cfb4d79124add35e0b19b50100074 | <ide><path>lib/assert.js
<ide> assert.fail = fail;
<ide> assert.AssertionError = AssertionError;
<ide>
<ide> function getBuffer(fd, assertLine) {
<del> var lines = 0;
<add> let lines = 0;
<ide> // Prevent blocking the event loop by limiting the maximum amount of
<ide> // data that may be read.
<del> var maxReads = 64; // bytesPerRead * maxReads = 512 kb
<del> var bytesRead = 0;
<del> var startBuffer = 0; // Start reading from that char on
<add> let maxReads = 64; // bytesPerRead * maxReads = 512 kb
<add> let bytesRead = 0;
<add> let startBuffer = 0; // Start reading from that char on
<ide> const bytesPerRead = 8192;
<ide> const buffers = [];
<ide> do {
<ide> function getErrMessage(call) {
<ide> return;
<ide> }
<ide>
<del> var fd;
<add> let fd, message;
<ide> try {
<ide> fd = openSync(filename, 'r', 0o666);
<ide> const buffers = getBuffer(fd, line);
<ide> function getErrMessage(call) {
<ide> // not user defined function names.
<ide> const ok = name === 'ok' ? '.ok' : '';
<ide> const args = node.arguments;
<del> var message = code
<add> message = code
<ide> .slice(args[0].start, args[args.length - 1].end)
<ide> .replace(escapeSequencesRegExp, escapeFn);
<add> if (EOL === '\r\n') {
<add> message = message.replace(/\r\n/g, '\n');
<add> }
<ide> message = 'The expression evaluated to a falsy value:' +
<del> `${EOL}${EOL} assert${ok}(${message})${EOL}`;
<add> `\n\n assert${ok}(${message})\n`;
<ide> }
<ide> // Make sure to always set the cache! No matter if the message is
<ide> // undefined or not
<ide><path>test/parallel/test-assert.js
<ide>
<ide> const common = require('../common');
<ide> const assert = require('assert');
<del>const { EOL } = require('os');
<ide> const EventEmitter = require('events');
<ide> const { errorCache } = require('internal/assert');
<ide> const { writeFileSync, unlinkSync } = require('fs');
<ide> assert.throws(
<ide> {
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert.ok(typeof 123 === 'string')${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> "assert.ok(typeof 123 === 'string')\n"
<ide> }
<ide> );
<ide> Error.stackTraceLimit = tmpLimit;
<ide> common.expectsError(
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<ide> generatedMessage: true,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert.ok(null)${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> 'assert.ok(null)\n'
<ide> }
<ide> );
<ide> common.expectsError(
<ide> common.expectsError(
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<ide> generatedMessage: true,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert(typeof 123 === 'string')${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> "assert(typeof 123 === 'string')\n"
<ide> }
<ide> );
<ide>
<ide> common.expectsError(
<ide> {
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert(Buffer.from('test') instanceof Error)${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> "assert(Buffer.from('test') instanceof Error)\n"
<ide> }
<ide> );
<ide> common.expectsError(
<ide> () => throwErr(),
<ide> {
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert(Buffer.from('test') instanceof Error)${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> "assert(Buffer.from('test') instanceof Error)\n"
<ide> }
<ide> );
<ide> fs.close = tmp;
<ide> common.expectsError(
<ide> {
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert((() => 'string')()${EOL}` +
<del> ` // eslint-disable-next-line${EOL}` +
<del> ` ===${EOL}` +
<del> ` 123 instanceof${EOL}` +
<del> ` Buffer)${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> "assert((() => 'string')()\n" +
<add> ' // eslint-disable-next-line\n' +
<add> ' ===\n' +
<add> ' 123 instanceof\n' +
<add> ' Buffer)\n'
<ide> }
<ide> );
<ide>
<ide> common.expectsError(
<ide> {
<ide> code: 'ERR_ASSERTION',
<ide> type: assert.AssertionError,
<del> message: `The expression evaluated to a falsy value:${EOL}${EOL} ` +
<del> `assert(null, undefined)${EOL}`
<add> message: 'The expression evaluated to a falsy value:\n\n ' +
<add> 'assert(null, undefined)\n'
<ide> }
<ide> );
<ide> | 2 |
Javascript | Javascript | code&learn var to let update | a7ddf8c5d23951778f904340511dc9c598ee98cb | <ide><path>test/parallel/test-repl-save-load.js
<ide> testMe._domain.on('error', function(reason) {
<ide> });
<ide>
<ide> const testFile = [
<del> 'var top = function() {',
<del> 'var inner = {one:1};'
<add> 'let top = function() {',
<add> 'let inner = {one:1};'
<ide> ];
<ide> const saveFileName = join(tmpdir.path, 'test.save.js');
<ide> | 1 |
Ruby | Ruby | add missing tests to validators | 4796be33a464a4587d0e22dfef113aca597c91c4 | <ide><path>activemodel/lib/active_model/validator.rb
<ide> class EachValidator < Validator
<ide> attr_reader :attributes
<ide>
<ide> def initialize(options)
<del> @attributes = options.delete(:attributes)
<add> @attributes = Array(options.delete(:attributes))
<add> raise ":attributes cannot be blank" if @attributes.empty?
<ide> super
<ide> check_validity!
<ide> end
<ide><path>activemodel/test/cases/validations/with_validation_test.rb
<ide> def validate(record)
<ide> end
<ide> end
<ide>
<add> class ValidatorPerEachAttribute < ActiveModel::EachValidator
<add> def validate_each(record, attribute, value)
<add> record.errors[attribute] << "Value is #{value}"
<add> end
<add> end
<add>
<add> class ValidatorCheckValidity < ActiveModel::EachValidator
<add> def check_validity!
<add> raise "boom!"
<add> end
<add> end
<add>
<ide> test "vaidation with class that adds errors" do
<ide> Topic.validates_with(ValidatorThatAddsErrors)
<ide> topic = Topic.new
<ide> def validate(record)
<ide> assert topic.errors[:base].include?(ERROR_MESSAGE)
<ide> end
<ide>
<add> test "validates_with each validator" do
<add> Topic.validates_with(ValidatorPerEachAttribute, :attributes => [:title, :content])
<add> topic = Topic.new :title => "Title", :content => "Content"
<add> assert !topic.valid?
<add> assert_equal ["Value is Title"], topic.errors[:title]
<add> assert_equal ["Value is Content"], topic.errors[:content]
<add> end
<add>
<add> test "each validator checks validity" do
<add> assert_raise RuntimeError do
<add> Topic.validates_with(ValidatorCheckValidity, :attributes => [:title])
<add> end
<add> end
<add>
<add> test "each validator expects attributes to be given" do
<add> assert_raise RuntimeError do
<add> Topic.validates_with(ValidatorPerEachAttribute)
<add> end
<add> end
<add>
<add> test "each validator skip nil values if :allow_nil is set to true" do
<add> Topic.validates_with(ValidatorPerEachAttribute, :attributes => [:title, :content], :allow_nil => true)
<add> topic = Topic.new :content => ""
<add> assert !topic.valid?
<add> assert topic.errors[:title].empty?
<add> assert_equal ["Value is "], topic.errors[:content]
<add> end
<add>
<add> test "each validator skip blank values if :allow_blank is set to true" do
<add> Topic.validates_with(ValidatorPerEachAttribute, :attributes => [:title, :content], :allow_blank => true)
<add> topic = Topic.new :content => ""
<add> assert topic.valid?
<add> assert topic.errors[:title].empty?
<add> assert topic.errors[:content].empty?
<add> end
<ide> end | 2 |
Python | Python | use model error_messages when available | 62c000bc12e63a4bb9de8d4cc84e8f1244bf6634 | <ide><path>rest_framework/utils/field_mapping.py
<ide> def get_field_kwargs(field_name, model_field):
<ide> ]
<ide>
<ide> if getattr(model_field, 'unique', False):
<del> validator = UniqueValidator(queryset=model_field.model._default_manager)
<add> unique_error_message = model_field.error_messages.get('unique', None)
<add> if unique_error_message:
<add> unique_error_message = unique_error_message % {
<add> 'model_name': model_field.model._meta.object_name,
<add> 'field_label': model_field.verbose_name
<add> }
<add> validator = UniqueValidator(
<add> queryset=model_field.model._default_manager,
<add> message=unique_error_message)
<ide> validator_kwarg.append(validator)
<ide>
<ide> if validator_kwarg:
<ide><path>tests/test_validators.py
<ide> def test_is_not_unique(self):
<ide> data = {'username': 'existing'}
<ide> serializer = UniquenessSerializer(data=data)
<ide> assert not serializer.is_valid()
<del> assert serializer.errors == {'username': ['This field must be unique.']}
<add> assert serializer.errors == {'username': ['UniquenessModel with this username already exists.']}
<ide>
<ide> def test_is_unique(self):
<ide> data = {'username': 'other'} | 2 |
Javascript | Javascript | add support for webpack 2's tree-shaking (#926) | f3e541fe23a2742b29b3d7305579fd1d06c02cb1 | <ide><path>server/build/babel/preset.js
<ide> const babelRuntimePath = require.resolve('babel-runtime/package')
<ide>
<ide> module.exports = {
<ide> presets: [
<del> require.resolve('babel-preset-es2015'),
<add> [require.resolve('babel-preset-es2015'), { modules: false }],
<ide> require.resolve('babel-preset-react')
<ide> ],
<ide> plugins: [
<ide><path>server/build/loaders/emit-file-loader.js
<ide> module.exports = function (content, sourceMap) {
<ide> const opts = { context, content, regExp }
<ide> const interpolatedName = loaderUtils.interpolateName(this, name, opts)
<ide>
<del> this.emitFile(interpolatedName, content, sourceMap)
<add> const emit = (code, map) => {
<add> this.emitFile(interpolatedName, code, map)
<add> this.callback(null, code, map)
<add> }
<ide>
<del> this.callback(null, content, sourceMap)
<add> if (query.transform) {
<add> const transformed = query.transform({ content, sourceMap })
<add> return emit(transformed.content, transformed.sourceMap)
<add> }
<add>
<add> return emit(content, sourceMap)
<ide> }
<ide><path>server/build/webpack.js
<ide> import UnlinkFilePlugin from './plugins/unlink-file-plugin'
<ide> import WatchPagesPlugin from './plugins/watch-pages-plugin'
<ide> import JsonPagesPlugin from './plugins/json-pages-plugin'
<ide> import getConfig from '../config'
<add>import * as babelCore from 'babel-core'
<ide>
<ide> const documentPage = join('pages', '_document.js')
<ide> const defaultPages = [
<ide> export default async function createCompiler (dir, { dev = false, quiet = false
<ide> return /node_modules/.test(str) && str.indexOf(nextPagesDir) !== 0
<ide> },
<ide> options: {
<del> name: 'dist/[path][name].[ext]'
<add> name: 'dist/[path][name].[ext]',
<add> // By default, our babel config does not transpile ES2015 module syntax because
<add> // webpack knows how to handle them. (That's how it can do tree-shaking)
<add> // But Node.js doesn't know how to handle them. So, we have to transpile them here.
<add> transform ({ content, sourceMap }) {
<add> const transpiled = babelCore.transform(content, {
<add> presets: ['es2015'],
<add> sourceMaps: dev ? 'both' : false,
<add> inputSourceMap: sourceMap
<add> })
<add>
<add> return {
<add> content: transpiled.code,
<add> sourceMap: transpiled.map
<add> }
<add> }
<ide> }
<ide> }, {
<ide> loader: 'babel-loader', | 3 |
Javascript | Javascript | resolve flow errors with reacttestrenderer | c78464f8ea9a5b00ec80252d20a71a1482210e57 | <ide><path>src/renderers/art/ReactART.js
<ide> function injectAfter(parentNode, referenceNode, node) {
<ide>
<ide> // ContainerMixin for components that can hold ART nodes
<ide>
<del>const ContainerMixin = assign({}, ReactMultiChild, {
<add>const ContainerMixin = assign({}, ReactMultiChild.prototype, {
<ide>
<ide> /**
<ide> * Moves a child component to the supplied index.
<ide><path>src/renderers/dom/shared/ReactDOMComponent.js
<ide> ReactDOMComponent.Mixin = {
<ide> Object.assign(
<ide> ReactDOMComponent.prototype,
<ide> ReactDOMComponent.Mixin,
<del> ReactMultiChild
<add> ReactMultiChild.prototype
<ide> );
<ide>
<ide> module.exports = ReactDOMComponent;
<ide><path>src/renderers/native/ReactNativeBaseComponent.js
<ide> ReactNativeBaseComponent.Mixin = {
<ide> */
<ide> Object.assign(
<ide> ReactNativeBaseComponent.prototype,
<del> ReactMultiChild,
<add> ReactMultiChild.prototype,
<ide> ReactNativeBaseComponent.Mixin,
<ide> NativeMethodsMixin
<ide> );
<ide><path>src/renderers/shared/stack/reconciler/ReactMultiChild.js
<ide> if (__DEV__) {
<ide> * children. This is used by `ReactDOMComponent` to mount, update, and
<ide> * unmount child components.
<ide> */
<del>var ReactMultiChild = {
<del> _reconcilerInstantiateChildren: function(nestedChildren, transaction, context) {
<add>class ReactMultiChild {
<add> _reconcilerInstantiateChildren(nestedChildren, transaction, context) {
<ide> if (__DEV__) {
<ide> var selfDebugID = getDebugID(this);
<ide> if (this._currentElement) {
<ide> var ReactMultiChild = {
<ide> return ReactChildReconciler.instantiateChildren(
<ide> nestedChildren, transaction, context
<ide> );
<del> },
<add> }
<ide>
<del> _reconcilerUpdateChildren: function(
<add> _reconcilerUpdateChildren(
<ide> prevChildren,
<ide> nextNestedChildrenElements,
<ide> mountImages,
<ide> var ReactMultiChild = {
<ide> selfDebugID
<ide> );
<ide> return nextChildren;
<del> },
<add> }
<ide>
<ide> /**
<ide> * Generates a "mount image" for each of the supplied children. In the case
<ide> var ReactMultiChild = {
<ide> * @return {array} An array of mounted representations.
<ide> * @internal
<ide> */
<del> mountChildren: function(nestedChildren, transaction, context) {
<add> mountChildren(nestedChildren, transaction, context) {
<ide> var children = this._reconcilerInstantiateChildren(
<ide> nestedChildren, transaction, context
<ide> );
<ide> var ReactMultiChild = {
<ide> }
<ide>
<ide> return mountImages;
<del> },
<add> }
<ide>
<ide> /**
<ide> * Replaces any rendered children with a text content string.
<ide> *
<ide> * @param {string} nextContent String of content.
<ide> * @internal
<ide> */
<del> updateTextContent: function(nextContent) {
<add> updateTextContent(nextContent) {
<ide> var prevChildren = this._renderedChildren;
<ide> // Remove any rendered children.
<ide> ReactChildReconciler.unmountChildren(prevChildren, false);
<ide> var ReactMultiChild = {
<ide> // Set new text content.
<ide> var updates = [makeTextContent(nextContent)];
<ide> processQueue(this, updates);
<del> },
<add> }
<ide>
<ide> /**
<ide> * Replaces any rendered children with a markup string.
<ide> *
<ide> * @param {string} nextMarkup String of markup.
<ide> * @internal
<ide> */
<del> updateMarkup: function(nextMarkup) {
<add> updateMarkup(nextMarkup) {
<ide> var prevChildren = this._renderedChildren;
<ide> // Remove any rendered children.
<ide> ReactChildReconciler.unmountChildren(prevChildren, false);
<ide> var ReactMultiChild = {
<ide> }
<ide> var updates = [makeSetMarkup(nextMarkup)];
<ide> processQueue(this, updates);
<del> },
<add> }
<ide>
<ide> /**
<ide> * Updates the rendered children with new children.
<ide> var ReactMultiChild = {
<ide> * @param {ReactReconcileTransaction} transaction
<ide> * @internal
<ide> */
<del> updateChildren: function(nextNestedChildrenElements, transaction, context) {
<add> updateChildren(nextNestedChildrenElements, transaction, context) {
<ide> // Hook used by React ART
<ide> this._updateChildren(nextNestedChildrenElements, transaction, context);
<del> },
<add> }
<ide>
<ide> /**
<ide> * @param {?object} nextNestedChildrenElements Nested child element maps.
<ide> * @param {ReactReconcileTransaction} transaction
<ide> * @final
<ide> * @protected
<ide> */
<del> _updateChildren: function(nextNestedChildrenElements, transaction, context) {
<add> _updateChildren(nextNestedChildrenElements, transaction, context) {
<ide> var prevChildren = this._renderedChildren;
<ide> var removedNodes = {};
<ide> var mountImages = [];
<ide> var ReactMultiChild = {
<ide> if (__DEV__) {
<ide> setChildrenForInstrumentation.call(this, nextChildren);
<ide> }
<del> },
<add> }
<ide>
<ide> /**
<ide> * Unmounts all rendered children. This should be used to clean up children
<ide> var ReactMultiChild = {
<ide> *
<ide> * @internal
<ide> */
<del> unmountChildren: function(safely) {
<add> unmountChildren(safely) {
<ide> var renderedChildren = this._renderedChildren;
<ide> ReactChildReconciler.unmountChildren(renderedChildren, safely);
<ide> this._renderedChildren = null;
<del> },
<add> }
<ide>
<ide> /**
<ide> * Moves a child component to the supplied index.
<ide> var ReactMultiChild = {
<ide> * @param {number} lastIndex Last index visited of the siblings of `child`.
<ide> * @protected
<ide> */
<del> moveChild: function(child, afterNode, toIndex, lastIndex) {
<add> moveChild(child, afterNode, toIndex, lastIndex) {
<ide> // If the index of `child` is less than `lastIndex`, then it needs to
<ide> // be moved. Otherwise, we do not need to move it because a child will be
<ide> // inserted or moved before `child`.
<ide> if (child._mountIndex < lastIndex) {
<ide> return makeMove(child, afterNode, toIndex);
<ide> }
<del> },
<add> }
<ide>
<ide> /**
<ide> * Creates a child component.
<ide> var ReactMultiChild = {
<ide> * @param {string} mountImage Markup to insert.
<ide> * @protected
<ide> */
<del> createChild: function(child, afterNode, mountImage) {
<add> createChild(child, afterNode, mountImage) {
<ide> return makeInsertMarkup(mountImage, afterNode, child._mountIndex);
<del> },
<add> }
<ide>
<ide> /**
<ide> * Removes a child component.
<ide> *
<ide> * @param {ReactComponent} child Child to remove.
<ide> * @protected
<ide> */
<del> removeChild: function(child, node) {
<add> removeChild(child, node) {
<ide> return makeRemove(child, node);
<del> },
<add> }
<ide>
<ide> /**
<ide> * Mounts a child with the supplied name.
<ide> var ReactMultiChild = {
<ide> * @param {ReactReconcileTransaction} transaction
<ide> * @private
<ide> */
<del> _mountChildAtIndex: function(
<add> _mountChildAtIndex(
<ide> child,
<ide> mountImage,
<ide> afterNode,
<ide> var ReactMultiChild = {
<ide> context) {
<ide> child._mountIndex = index;
<ide> return this.createChild(child, afterNode, mountImage);
<del> },
<add> }
<ide>
<ide> /**
<ide> * Unmounts a rendered child.
<ide> var ReactMultiChild = {
<ide> * @param {ReactComponent} child Component to unmount.
<ide> * @private
<ide> */
<del> _unmountChild: function(child, node) {
<add> _unmountChild(child, node) {
<ide> var update = this.removeChild(child, node);
<ide> child._mountIndex = null;
<ide> return update;
<del> },
<add> }
<ide> };
<ide>
<ide> module.exports = ReactMultiChild;
<ide><path>src/renderers/shared/stack/reconciler/ReactOwner.js
<ide> var invariant = require('invariant');
<ide>
<ide> import type { ReactInstance } from 'ReactInstanceType';
<add>import type { Transaction } from 'Transaction';
<ide>
<ide> /**
<ide> * @param {?object} object
<ide> var ReactOwner = {
<ide> component: ReactInstance,
<ide> ref: string,
<ide> owner: ReactInstance,
<del> transaction,
<add> transaction: Transaction,
<ide> ): void {
<ide> invariant(
<ide> isValidOwner(owner),
<ide><path>src/renderers/testing/ReactTestEmptyComponent.js
<ide> 'use strict';
<ide>
<ide> class ReactTestEmptyComponent {
<add> _currentElement: null;
<add>
<ide> constructor() {
<ide> this._currentElement = null;
<ide> }
<ide><path>src/renderers/testing/ReactTestMount.js
<ide> var getHostComponentFromComposite = require('getHostComponentFromComposite');
<ide> var instantiateReactComponent = require('instantiateReactComponent');
<ide> var invariant = require('invariant');
<ide>
<del>type TestRendererOptions = {
<del> createNodeMock: (element: ReactElement) => Object,
<add>import type { ReactElement } from 'ReactElementType';
<add>
<add>export type TestRendererOptions = {
<add> createNodeMock: (element: ReactElement) => any,
<ide> };
<ide>
<ide> var defaultTestOptions = {
<ide><path>src/renderers/testing/ReactTestReconcileTransaction.js
<ide> var PooledClass = require('PooledClass');
<ide> var Transaction = require('Transaction');
<ide> var ReactUpdateQueue = require('ReactUpdateQueue');
<ide>
<add>import type { TestRendererOptions } from 'ReactTestMount';
<add>
<ide> /**
<ide> * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks during
<ide> * the performing of the transaction.
<ide> var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
<ide> *
<ide> * @class ReactTestReconcileTransaction
<ide> */
<del>function ReactTestReconcileTransaction(testOptions) {
<add>function ReactTestReconcileTransaction(testOptions: TestRendererOptions) {
<ide> this.reinitializeTransaction();
<ide> this.testOptions = testOptions;
<ide> this.reactMountReady = CallbackQueue.getPooled(this);
<ide><path>src/renderers/testing/ReactTestRenderer.js
<ide> var ReactTestTextComponent = require('ReactTestTextComponent');
<ide> var ReactTestEmptyComponent = require('ReactTestEmptyComponent');
<ide>
<ide> import type { ReactElement } from 'ReactElementType';
<add>import type { ReactInstance } from 'ReactInstanceType';
<ide>
<ide> type ReactTestRendererJSON = {
<ide> type: string,
<ide> props: { [propName: string]: string },
<del> children: Array<string | ReactTestRendererJSON>,
<add> children: null | Array<string | ReactTestRendererJSON>,
<add> $$typeof?: any
<ide> }
<ide>
<ide> /**
<ide> function getRenderedHostOrTextFromComponent(component) {
<ide> return component;
<ide> }
<ide>
<del>class ReactTestComponent {
<add>class ReactTestComponent extends ReactMultiChild {
<add> _currentElement: ReactElement;
<add> _renderedChildren: null | Object;
<add> _topLevelWrapper: null | ReactInstance;
<add>
<ide> constructor(element: ReactElement) {
<add> super();
<ide> this._currentElement = element;
<ide> this._renderedChildren = null;
<ide> this._topLevelWrapper = null;
<ide> class ReactTestComponent {
<ide> childrenJSON.push(json);
<ide> }
<ide> }
<del> var object = {
<add> var object: ReactTestRendererJSON = {
<ide> type: this._currentElement.type,
<ide> props: props,
<ide> children: childrenJSON.length ? childrenJSON : null,
<ide> class ReactTestComponent {
<ide> unmountComponent(): void {}
<ide> }
<ide>
<del>Object.assign(ReactTestComponent.prototype, ReactMultiChild);
<del>
<ide> // =============================================================================
<ide>
<ide> ReactUpdates.injection.injectReconcileTransaction(
<ide><path>src/renderers/testing/ReactTestTextComponent.js
<ide> import type { ReactText } from 'ReactTypes';
<ide>
<ide> class ReactTestTextComponent {
<add> _currentElement: ReactText;
<add>
<ide> constructor(element: ReactText) {
<ide> this._currentElement = element;
<ide> } | 10 |
Python | Python | remove redundant note on http provider | f2a8a73ca99912d25e9cd8142038cf3a6df622d6 | <ide><path>setup.py
<ide> def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version
<ide> 'requests>=2.26.0',
<ide> ]
<ide> http_provider = [
<del> # NOTE ! The HTTP provider is NOT preinstalled by default when Airflow is installed - because it
<del> # depends on `requests` library and until `chardet` is mandatory dependency of `requests`
<del> # See https://github.com/psf/requests/pull/5797
<del> # This means that providers that depend on Http and cannot work without it, have to have
<del> # explicit dependency on `apache-airflow-providers-http` which needs to be pulled in for them.
<del> # Other cross-provider-dependencies are optional (usually cross-provider dependencies only enable
<del> # some features of providers and majority of those providers works). They result with an extra,
<del> # not with the `install-requires` dependency.
<ide> 'apache-airflow-providers-http',
<ide> ]
<ide> jdbc = [ | 1 |
PHP | PHP | use consistent method logic | 56a0b6d2d967bb43dee23e682c1ed74f4ae3f3a6 | <ide><path>src/Utility/Inflector.php
<ide> public static function normalize($string, $replacement = '_')
<ide> */
<ide> public static function tableize($className)
<ide> {
<del> if (!($result = static::_cache(__FUNCTION__, $className))) {
<add> $result = static::_cache(__FUNCTION__, $className);
<add>
<add> if ($result === false) {
<ide> $result = static::pluralize(static::underscore($className));
<ide> static::_cache(__FUNCTION__, $className, $result);
<ide> }
<add>
<ide> return $result;
<ide> }
<ide>
<ide> public static function tableize($className)
<ide> */
<ide> public static function classify($tableName)
<ide> {
<del> if (!($result = static::_cache(__FUNCTION__, $tableName))) {
<add> $result = static::_cache(__FUNCTION__, $tableName);
<add>
<add> if ($result === false) {
<ide> $result = static::camelize(static::singularize($tableName));
<ide> static::_cache(__FUNCTION__, $tableName, $result);
<ide> }
<add>
<ide> return $result;
<ide> }
<ide>
<ide> public static function classify($tableName)
<ide> */
<ide> public static function variable($string)
<ide> {
<del> if (!($result = static::_cache(__FUNCTION__, $string))) {
<add> $result = static::_cache(__FUNCTION__, $string);
<add>
<add> if ($result === false) {
<ide> $camelized = static::camelize(static::underscore($string));
<ide> $replace = strtolower(substr($camelized, 0, 1));
<ide> $result = preg_replace('/\\w/', $replace, $camelized, 1);
<ide> static::_cache(__FUNCTION__, $string, $result);
<ide> }
<add>
<ide> return $result;
<ide> }
<ide> | 1 |
Javascript | Javascript | improve disable asynclocalstorage test | 68e36ade3de2205c583f2cc6a2d2ec192b75cc95 | <ide><path>test/async-hooks/test-async-local-storage-enable-disable.js
<ide> asyncLocalStorage.runSyncAndReturn(new Map(), () => {
<ide> asyncLocalStorage.getStore().set('foo', 'bar');
<ide> process.nextTick(() => {
<ide> assert.strictEqual(asyncLocalStorage.getStore().get('foo'), 'bar');
<add> process.nextTick(() => {
<add> assert.strictEqual(asyncLocalStorage.getStore(), undefined);
<add> });
<ide> asyncLocalStorage.disable();
<ide> assert.strictEqual(asyncLocalStorage.getStore(), undefined);
<ide> process.nextTick(() => { | 1 |
Javascript | Javascript | use reserved ip in test-net-connect-timeout | ae8d436623109f315229ca9cc05715af362257b0 | <ide><path>test/internet/test-net-connect-timeout.js
<ide> var gotConnect = false;
<ide>
<ide> var T = 100;
<ide>
<del>
<del>// 240.*.*.*.* is "reserved for future use"
<del>var socket = net.createConnection(9999, '240.0.0.0');
<add>// 192.0.2.1 is part of subnet assigned as "TEST-NET" in RFC 5737.
<add>// For use solely in documentation and example source code.
<add>// In short, it should be unreachable.
<add>// In practice, it's a network black hole.
<add>var socket = net.createConnection(9999, '192.0.2.1');
<ide>
<ide> socket.setTimeout(T);
<ide> | 1 |
Javascript | Javascript | allow unauthenticated donations for year-end | 663f726c4ed488eebadea25d0521213460301692 | <ide><path>api-server/server/boot/donate.js
<ide> import { isEmail, isNumeric } from 'validator';
<ide>
<ide> import {
<ide> durationKeysConfig,
<del> // donationOneTimeConfig,
<add> donationOneTimeConfig,
<ide> donationSubscriptionConfig
<ide> } from '../../../config/donation-settings';
<ide> import keys from '../../../config/secrets';
<ide> const log = debug('fcc:boot:donate');
<ide>
<ide> export default function donateBoot(app, done) {
<ide> let stripe = false;
<add> const { User } = app.models;
<ide> const api = app.loopback.Router();
<ide> const donateRouter = app.loopback.Router();
<ide>
<ide> export default function donateBoot(app, done) {
<ide> isNumeric('' + amount) &&
<ide> durationKeysConfig.includes(duration) &&
<ide> duration === 'onetime'
<del> ? // eslint-disable-next-line no-inline-comments
<del> amount > 1 // donationOneTimeConfig.includes(amount)
<add> ? donationOneTimeConfig.includes(amount)
<ide> : donationSubscriptionConfig.plans[duration];
<ide> }
<ide>
<ide> export default function donateBoot(app, done) {
<ide> });
<ide> }
<ide>
<add> function createStripeDonationYearEnd(req, res) {
<add> const { user, body } = req;
<add>
<add> const {
<add> amount,
<add> duration,
<add> token: { email, id }
<add> } = body;
<add>
<add> if (amount < 1 || duration !== 'onetime' || !isEmail(email)) {
<add> return res.status(500).send({
<add> error: 'The donation form had invalid values for this submission.'
<add> });
<add> }
<add>
<add> const fccUser = user
<add> ? Promise.resolve(user)
<add> : new Promise((resolve, reject) =>
<add> User.findOrCreate(
<add> { where: { email } },
<add> { email },
<add> (err, instance, isNew) => {
<add> log('is new user instance: ', isNew);
<add> if (err) {
<add> return reject(err);
<add> }
<add> return resolve(instance);
<add> }
<add> )
<add> );
<add>
<add> let donatingUser = {};
<add> let donation = {
<add> email,
<add> amount,
<add> duration,
<add> provider: 'stripe',
<add> startDate: new Date(Date.now()).toISOString()
<add> };
<add>
<add> const createCustomer = user => {
<add> donatingUser = user;
<add> return stripe.customers.create({
<add> email,
<add> card: id
<add> });
<add> };
<add>
<add> const createOneTimeCharge = customer => {
<add> donation.customerId = customer.id;
<add> return stripe.charges.create({
<add> amount: amount,
<add> currency: 'usd',
<add> customer: customer.id
<add> });
<add> };
<add>
<add> const createAsyncUserDonation = () => {
<add> donatingUser
<add> .createDonation(donation)
<add> .toPromise()
<add> .catch(err => {
<add> throw new Error(err);
<add> });
<add> };
<add>
<add> return Promise.resolve(fccUser)
<add> .then(nonDonatingUser => {
<add> const { isDonating } = nonDonatingUser;
<add> if (isDonating) {
<add> throw {
<add> message: `User already has active donation(s).`,
<add> type: 'AlreadyDonatingError'
<add> };
<add> }
<add> return nonDonatingUser;
<add> })
<add> .then(createCustomer)
<add> .then(customer => {
<add> return createOneTimeCharge(customer).then(charge => {
<add> donation.subscriptionId = 'one-time-charge-prefix-' + charge.id;
<add> return res.send(charge);
<add> });
<add> })
<add> .then(createAsyncUserDonation)
<add> .catch(err => {
<add> if (
<add> err.type === 'StripeCardError' ||
<add> err.type === 'AlreadyDonatingError'
<add> ) {
<add> return res.status(402).send({ error: err.message });
<add> }
<add> return res
<add> .status(500)
<add> .send({ error: 'Donation failed due to a server error.' });
<add> });
<add> }
<add>
<ide> function createHmacHash(req, res) {
<ide> const { user, body } = req;
<ide>
<ide> export default function donateBoot(app, done) {
<ide> done();
<ide> } else {
<ide> api.post('/charge-stripe', createStripeDonation);
<add> api.post('/charge-stripe-year-end', createStripeDonationYearEnd);
<ide> api.post('/create-hmac-hash', createHmacHash);
<ide> donateRouter.use('/donate', api);
<ide> app.use(donateRouter);
<ide> app.use('/internal', donateRouter);
<add> app.use('/unauthenticated', donateRouter);
<ide> connectToStripe().then(done);
<ide> }
<ide> }
<ide><path>client/src/components/Donation/components/DonateFormChildViewForHOC.js
<ide> const propTypes = {
<ide> stripe: PropTypes.shape({
<ide> createToken: PropTypes.func.isRequired
<ide> }),
<del> theme: PropTypes.string
<add> theme: PropTypes.string,
<add> yearEndGift: PropTypes.bool
<ide> };
<ide> const initialState = {
<ide> donationState: {
<ide> class DonateFormChildViewForHOC extends Component {
<ide>
<ide> postDonation(token) {
<ide> const { donationAmount: amount, donationDuration: duration } = this.state;
<add> const { yearEndGift } = this.props;
<ide> this.setState(state => ({
<ide> ...state,
<ide> donationState: {
<ide> class DonateFormChildViewForHOC extends Component {
<ide> this.props.showCloseBtn();
<ide> }
<ide>
<del> return postChargeStripe({
<add> return postChargeStripe(yearEndGift, {
<ide> token,
<ide> amount,
<ide> duration
<ide><path>client/src/components/YearEndGift/YearEndDonationForm.js
<ide> class YearEndDonationForm extends Component {
<ide> donationAmount={donationAmount}
<ide> donationDuration={donationDuration}
<ide> getDonationButtonLabel={this.getDonationButtonLabel}
<add> yearEndGift={true}
<ide> />
<ide> </Elements>
<ide> </StripeProvider>
<ide><path>client/src/utils/ajax.js
<ide> export function getArticleById(shortId) {
<ide> }
<ide>
<ide> /** POST **/
<del>export function postChargeStripe(body) {
<del> return post(`/donate/charge-stripe`, body);
<add>export function postChargeStripe(yearEndGift, body) {
<add> return yearEndGift
<add> ? postUnauthenticated('/donate/charge-stripe-year-end', body)
<add> : post('/donate/charge-stripe', body);
<ide> }
<ide>
<ide> export function postCreateHmacHash(body) { | 4 |
Python | Python | improve documentation of download-wheels | 505ae178178bac36929bf8afe5d523a4d659531c | <ide><path>tools/download-wheels.py
<del>#!/usr/bin/env python
<add>#!/usr/bin/env python3
<add># -*- encoding:utf-8 -*-
<ide> """
<del>Download NumPy wheels from Anaconda staging area.
<add>Script to download NumPy wheels from the Anaconda staging area.
<add>
<add>Usage::
<add>
<add> $ ./tools/download-wheels.py <version> -w <optional-wheelhouse>
<add>
<add>The default wheelhouse is ``release/installers``.
<add>
<add>Dependencies
<add>------------
<add>
<add>- beautifulsoup4
<add>- urllib3
<add>
<add>Examples
<add>--------
<add>
<add>While in the repository root::
<add>
<add> $ python tools/download-wheels.py 1.19.0
<add> $ python tools/download-wheels.py 1.19.0 -w ~/wheelhouse
<ide>
<ide> """
<del>import sys
<ide> import os
<ide> import re
<ide> import shutil
<ide> STAGING_URL = 'https://anaconda.org/multibuild-wheels-staging/numpy'
<ide> PREFIX = 'numpy'
<ide>
<add>
<ide> def get_wheel_names(version):
<ide> """ Get wheel names from Anaconda HTML directory.
<ide>
<ide> def download_wheels(version, wheelhouse):
<ide> parser = argparse.ArgumentParser()
<ide> parser.add_argument(
<ide> "version",
<del> help="NumPy version to download.")
<add> help="NumPy version to download.")
<ide> parser.add_argument(
<ide> "-w", "--wheelhouse",
<ide> default=os.path.join(os.getcwd(), "release", "installers"), | 1 |
Python | Python | make a proper list from zip iterator | 9d1e6de4a0701362ccaf352f845fe8a853eaf2fb | <ide><path>spacy/tests/parser/test_nonproj.py
<ide> def deprojectivize(proj_heads, deco_labels, EN):
<ide> sent = EN.tokenizer.tokens_from_list(['whatever'] * slen)
<ide> rel_proj_heads = [ head-i for i,head in enumerate(proj_heads) ]
<ide> labelids = [ EN.vocab.strings[label] for label in deco_labels ]
<del> pairs = zip(rel_proj_heads,labelids)
<add> pairs = list(zip(rel_proj_heads,labelids))
<ide> parse = numpy.asarray(pairs, dtype=numpy.int32)
<ide> sent.from_array([HEAD,DEP],parse)
<ide> PseudoProjectivity.deprojectivize(sent) | 1 |
Javascript | Javascript | remove bundle.js file | 00db3039bd6986796f4f80ce2d1d1e9c4df2db81 | <ide><path>test/fixtures/bundle.js
<del>/*
<del> * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
<del> * This devtool is neither made for production nor for readable output files.
<del> * It uses "eval()" calls to create a separate source file in the browser devtools.
<del> * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
<del> * or disable the default devtool with "devtool: false".
<del> * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
<del> */
<del>/******/ (() => { // webpackBootstrap
<del>/******/ var __webpack_modules__ = ({
<del>
<del>/***/ "./test/fixtures/a.js":
<del>/*!****************************!*\
<del> !*** ./test/fixtures/a.js ***!
<del> \****************************/
<del>/***/ ((module) => {
<del>
<del>eval("module.exports = function a() {\n\treturn \"This is a\";\n};\n\n//# sourceURL=webpack://webpack/./test/fixtures/a.js?");
<del>
<del>/***/ })
<del>
<del>/******/ });
<del>/************************************************************************/
<del>/******/ // The module cache
<del>/******/ var __webpack_module_cache__ = {};
<del>/******/
<del>/******/ // The require function
<del>/******/ function __webpack_require__(moduleId) {
<del>/******/ // Check if module is in cache
<del>/******/ var cachedModule = __webpack_module_cache__[moduleId];
<del>/******/ if (cachedModule !== undefined) {
<del>/******/ return cachedModule.exports;
<del>/******/ }
<del>/******/ // Create a new module (and put it into the cache)
<del>/******/ var module = __webpack_module_cache__[moduleId] = {
<del>/******/ // no module.id needed
<del>/******/ // no module.loaded needed
<del>/******/ exports: {}
<del>/******/ };
<del>/******/
<del>/******/ // Execute the module function
<del>/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
<del>/******/
<del>/******/ // Return the exports of the module
<del>/******/ return module.exports;
<del>/******/ }
<del>/******/
<del>/************************************************************************/
<del>/******/
<del>/******/ // startup
<del>/******/ // Load entry module and return exports
<del>/******/ // This entry module is referenced by other modules so it can't be inlined
<del>/******/ var __webpack_exports__ = __webpack_require__("./test/fixtures/a.js");
<del>/******/
<del>/******/ })()
<del>;
<ide>\ No newline at end of file | 1 |
Javascript | Javascript | remove double space in test name | 781212aab344b1619806369d768fad0c1ac3e04a | <ide><path>packages/react/src/__tests__/ReactChildren-test.js
<ide> describe('ReactChildren', () => {
<ide> );
<ide> });
<ide>
<del> it('does not warn when there are keys on elements in a fragment', () => {
<add> it('does not warn when there are keys on elements in a fragment', () => {
<ide> class ComponentReturningArray extends React.Component {
<ide> render() {
<ide> return [<div key="foo" />, <div key="bar" />]; | 1 |
Ruby | Ruby | put exception, retry on missing formula | 159ba9b012415ec5bd1c446c66a02702a7909225 | <ide><path>Library/Homebrew/dev-cmd/test-bot.rb
<ide> def no_args?
<ide>
<ide> def safe_formula_canonical_name(formula_name)
<ide> Formulary.factory(formula_name).full_name
<del> rescue TapFormulaUnavailableError => e
<add> rescue TapFormulaUnavailableError, FormulaUnavailableError => e
<ide> raise if e.tap.installed?
<ide> test "brew", "tap", e.tap.name
<ide> retry unless steps.last.failed?
<del> rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError => e
<add> onoe e
<add> puts e.backtrace
<add> rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError => e
<ide> onoe e
<ide> puts e.backtrace
<ide> end | 1 |
Python | Python | update exception styles, trickier ones | e1a9692cc36e4353798a332c834fce7aa6cf9b54 | <ide><path>numpy/core/_mx_datetime_parser.py
<ide> def utc_offset(zone):
<ide> return _zonetable[uzone]*60
<ide> offset = _zoneoffsetRE.match(zone)
<ide> if not offset:
<del> raise ValueError,'wrong format or unkown time zone: "%s"' % zone
<add> raise ValueError('wrong format or unkown time zone: "%s"' % zone)
<ide> zonesign,hours,minutes,extra = offset.groups()
<ide> if extra:
<del> raise ValueError,'illegal time zone offset: "%s"' % zone
<add> raise ValueError('illegal time zone offset: "%s"' % zone)
<ide> offset = int(hours or 0) * 60 + int(minutes or 0)
<ide> if zonesign == '-':
<ide> offset = -offset
<ide> def _parse_date(text):
<ide>
<ide> elif not style:
<ide> # Not recognized: raise an error
<del> raise ValueError, 'unknown date format: "%s"' % text
<add> raise ValueError('unknown date format: "%s"' % text)
<ide>
<ide> # Literal date post-processing
<ide> if style in ('lit', 'altlit', 'eurlit'):
<ide> def _parse_time(text):
<ide>
<ide> if not style:
<ide> # If no default handling should be applied, raise an error
<del> raise ValueError, 'unknown time format: "%s"' % text
<add> raise ValueError('unknown time format: "%s"' % text)
<ide>
<ide> # Post-processing
<ide> if match is not None:
<ide><path>numpy/core/getlimits.py
<ide> def __new__(cls, dtype):
<ide> dtypes.append(newdtype)
<ide> dtype = newdtype
<ide> if not issubclass(dtype, numeric.inexact):
<del> raise ValueError, "data type %r not inexact" % (dtype)
<add> raise ValueError("data type %r not inexact" % (dtype))
<ide> obj = cls._finfo_cache.get(dtype,None)
<ide> if obj is not None:
<ide> return obj
<ide><path>numpy/core/numeric.py
<ide> def setbufsize(size):
<ide>
<ide> """
<ide> if size > 10e6:
<del> raise ValueError, "Buffer size, %s, is too big." % size
<add> raise ValueError("Buffer size, %s, is too big." % size)
<ide> if size < 5:
<del> raise ValueError, "Buffer size, %s, is too small." %size
<add> raise ValueError("Buffer size, %s, is too small." %size)
<ide> if size % 16 != 0:
<del> raise ValueError, "Buffer size, %s, is not a multiple of 16." %size
<add> raise ValueError("Buffer size, %s, is not a multiple of 16." %size)
<ide>
<ide> pyvals = umath.geterrobj()
<ide> old = getbufsize()
<ide><path>numpy/core/records.py
<ide> def _setfieldnames(self, names, titles):
<ide> elif (type(names) == str):
<ide> names = names.split(',')
<ide> else:
<del> raise NameError, "illegal input names %s" % `names`
<add> raise NameError("illegal input names %s" % `names`)
<ide>
<ide> self._names = [n.strip() for n in names[:self._nfields]]
<ide> else:
<ide> def _setfieldnames(self, names, titles):
<ide> # check for redundant names
<ide> _dup = find_duplicate(self._names)
<ide> if _dup:
<del> raise ValueError, "Duplicate field names: %s" % _dup
<add> raise ValueError("Duplicate field names: %s" % _dup)
<ide>
<ide> if (titles):
<ide> self._titles = [n.strip() for n in titles[:self._nfields]]
<ide> def __getattribute__(self, attr):
<ide>
<ide> def __setattr__(self, attr, val):
<ide> if attr in ['setfield', 'getfield', 'dtype']:
<del> raise AttributeError, "Cannot set '%s' attribute" % attr
<add> raise AttributeError("Cannot set '%s' attribute" % attr)
<ide> fielddict = nt.void.__getattribute__(self, 'dtype').fields
<ide> res = fielddict.get(attr, None)
<ide> if res:
<ide> def __getattribute__(self, attr):
<ide> try:
<ide> res = fielddict[attr][:2]
<ide> except (TypeError, KeyError):
<del> raise AttributeError, "record array has no attribute %s" % attr
<add> raise AttributeError("record array has no attribute %s" % attr)
<ide> obj = self.getfield(*res)
<ide> # if it has fields return a recarray, otherwise return
<ide> # normal array
<ide> def __setattr__(self, attr, val):
<ide> try:
<ide> res = fielddict[attr][:2]
<ide> except (TypeError, KeyError):
<del> raise AttributeError, "record array has no attribute %s" % attr
<add> raise AttributeError("record array has no attribute %s" % attr)
<ide> return self.setfield(val, *res)
<ide>
<ide> def __getitem__(self, indx):
<ide> def fromarrays(arrayList, dtype=None, shape=None, formats=None,
<ide> nn = len(descr[k].shape)
<ide> testshape = obj.shape[:len(obj.shape) - nn]
<ide> if testshape != shape:
<del> raise ValueError, "array-shape mismatch in array %d" % k
<add> raise ValueError("array-shape mismatch in array %d" % k)
<ide>
<ide> _array = recarray(shape, descr)
<ide>
<ide><path>numpy/core/src/multiarray/testcalcs.py
<ide> def days_from_ymd(year, month, day):
<ide> # Negative month values indicate months relative to the years end */
<ide> if (month < 0): month += 13
<ide> if not (month >= 1 and month<=12):
<del> raise ValueError, "month out of range (1-21): %d" % month
<add> raise ValueError("month out of range (1-21): %d" % month)
<ide>
<ide> # Negative values indicate days relative to the months end */
<ide> if (day < 0): day += days_in_month[leap][month - 1] + 1
<ide> if not (day >= 1 and day <= days_in_month[leap][month-1]):
<del> raise ValueError, "day out of range: %d" % day
<add> raise ValueError("day out of range: %d" % day)
<ide>
<ide> # Number of days between Dec 31, (year - 1) and Dec 31, 1969
<ide> # (can be negative).
<ide><path>numpy/ctypeslib.py
<ide> def from_param(cls, obj):
<ide> raise TypeError("argument must be an ndarray")
<ide> if cls._dtype_ is not None \
<ide> and obj.dtype != cls._dtype_:
<del> raise TypeError, "array must have data type %s" % cls._dtype_
<add> raise TypeError("array must have data type %s" % cls._dtype_)
<ide> if cls._ndim_ is not None \
<ide> and obj.ndim != cls._ndim_:
<del> raise TypeError, "array must have %d dimension(s)" % cls._ndim_
<add> raise TypeError("array must have %d dimension(s)" % cls._ndim_)
<ide> if cls._shape_ is not None \
<ide> and obj.shape != cls._shape_:
<del> raise TypeError, "array must have shape %s" % str(cls._shape_)
<add> raise TypeError("array must have shape %s" % str(cls._shape_))
<ide> if cls._flags_ is not None \
<ide> and ((obj.flags.num & cls._flags_) != cls._flags_):
<ide> raise TypeError, "array must have flags %s" % \
<ide><path>numpy/dual.py
<ide>
<ide> def register_func(name, func):
<ide> if name not in __all__:
<del> raise ValueError, "%s not a dual function." % name
<add> raise ValueError("%s not a dual function." % name)
<ide> f = sys._getframe(0).f_globals
<ide> _restore_dict[name] = f[name]
<ide> f[name] = func
<ide>
<ide> def restore_func(name):
<ide> if name not in __all__:
<del> raise ValueError, "%s not a dual function." % name
<add> raise ValueError("%s not a dual function." % name)
<ide> try:
<ide> val = _restore_dict[name]
<ide> except KeyError:
<ide><path>numpy/f2py/crackfortran.py
<ide> def readfortrancode(ffile,dowithline=show,istop=1):
<ide> ll=l
<ide> cont=(r is not None)
<ide> else:
<del> raise ValueError,"Flag sourcecodeform must be either 'fix' or 'free': %s"%`sourcecodeform`
<add> raise ValueError("Flag sourcecodeform must be either 'fix' or 'free': %s"%`sourcecodeform`)
<ide> filepositiontext='Line #%d in %s:"%s"\n\t' % (fin.filelineno()-1,currentfilename,l1)
<ide> m=includeline.match(origfinalline)
<ide> if m:
<ide><path>numpy/f2py/f2py2e.py
<ide> def run_main(comline_list):
<ide> if postlist[i]['block']!='python module':
<ide> if 'python module' not in options:
<ide> errmess('Tip: If your original code is Fortran source then you must use -m option.\n')
<del> raise TypeError,'All blocks must be python module blocks but got %s'%(`postlist[i]['block']`)
<add> raise TypeError('All blocks must be python module blocks but got %s'%(`postlist[i]['block']`))
<ide> auxfuncs.debugoptions=options['debug']
<ide> f90mod_rules.options=options
<ide> auxfuncs.wrapfuncs=options['wrapfuncs']
<ide><path>numpy/lib/npyio.py
<ide> def __getitem__(self, key):
<ide> else:
<ide> return bytes
<ide> else:
<del> raise KeyError, "%s is not a file in the archive" % key
<add> raise KeyError("%s is not a file in the archive" % key)
<ide>
<ide>
<ide> def __iter__(self):
<ide> def _savez(file, args, kwds, compress):
<ide> for i, val in enumerate(args):
<ide> key = 'arr_%d' % i
<ide> if key in namedict.keys():
<del> raise ValueError, "Cannot use un-named variables and keyword %s" % key
<add> raise ValueError("Cannot use un-named variables and keyword %s" % key)
<ide> namedict[key] = val
<ide>
<ide> if compress:
<ide><path>numpy/linalg/linalg.py
<ide> def qr(a, mode='full'):
<ide> work = zeros((lwork,), t)
<ide> results = lapack_routine(m, n, a, m, tau, work, -1, 0)
<ide> if results['info'] != 0:
<del> raise LinAlgError, '%s returns %d' % (routine_name, results['info'])
<add> raise LinAlgError('%s returns %d' % (routine_name, results['info']))
<ide>
<ide> # do qr decomposition
<ide> lwork = int(abs(work[0]))
<ide> work = zeros((lwork,), t)
<ide> results = lapack_routine(m, n, a, m, tau, work, lwork, 0)
<ide>
<ide> if results['info'] != 0:
<del> raise LinAlgError, '%s returns %d' % (routine_name, results['info'])
<add> raise LinAlgError('%s returns %d' % (routine_name, results['info']))
<ide>
<ide> # economic mode. Isn't actually economic.
<ide> if mode[0] == 'e':
<ide> def qr(a, mode='full'):
<ide> work = zeros((lwork,), t)
<ide> results = lapack_routine(m, mn, mn, a, m, tau, work, -1, 0)
<ide> if results['info'] != 0:
<del> raise LinAlgError, '%s returns %d' % (routine_name, results['info'])
<add> raise LinAlgError('%s returns %d' % (routine_name, results['info']))
<ide>
<ide> # compute q
<ide> lwork = int(abs(work[0]))
<ide> work = zeros((lwork,), t)
<ide> results = lapack_routine(m, mn, mn, a, m, tau, work, lwork, 0)
<ide> if results['info'] != 0:
<del> raise LinAlgError, '%s returns %d' % (routine_name, results['info'])
<add> raise LinAlgError('%s returns %d' % (routine_name, results['info']))
<ide>
<ide> q = _fastCopyAndTranspose(result_t, a[:mn,:])
<ide>
<ide><path>numpy/ma/mrecords.py
<ide> def __getattribute__(self, attr):
<ide> try:
<ide> res = fielddict[attr][:2]
<ide> except (TypeError, KeyError):
<del> raise AttributeError, "record array has no attribute %s" % attr
<add> raise AttributeError("record array has no attribute %s" % attr)
<ide> # So far, so good...
<ide> _localdict = ndarray.__getattribute__(self, '__dict__')
<ide> _data = ndarray.view(self, _localdict['_baseclass'])
<ide> def __setattr__(self, attr, val):
<ide> try:
<ide> res = fielddict[attr][:2]
<ide> except (TypeError, KeyError):
<del> raise AttributeError, "record array has no attribute %s" % attr
<add> raise AttributeError("record array has no attribute %s" % attr)
<ide> #
<ide> if val is masked:
<ide> _fill_value = _localdict['_fill_value']
<ide> def openfile(fname):
<ide> try:
<ide> f = open(fname)
<ide> except IOError:
<del> raise IOError, "No such file: '%s'" % fname
<add> raise IOError("No such file: '%s'" % fname)
<ide> if f.readline()[:2] != "\\x":
<ide> f.seek(0, 0)
<ide> return f
<ide><path>numpy/matrixlib/defmatrix.py
<ide> def _from_string(str,gdict,ldict):
<ide> try:
<ide> thismat = gdict[col]
<ide> except KeyError:
<del> raise KeyError, "%s not found" % (col,)
<add> raise KeyError("%s not found" % (col,))
<ide>
<ide> coltup.append(thismat)
<ide> rowtup.append(concatenate(coltup,axis=-1))
<ide><path>numpy/oldnumeric/ma.py
<ide> def __array__ (self, t=None, context=None):
<ide> func, args, i = context
<ide> fills = ufunc_fills.get(func)
<ide> if fills is None:
<del> raise MAError, "%s not known to ma" % func
<add> raise MAError("%s not known to ma" % func)
<ide> return self.filled(fills[i])
<ide> else: # Mask is all false
<ide> # Optimize to avoid future invocations of this section. | 14 |
Go | Go | implement dockerregistrysuite in integration-cli | f696b1071a296bee1f4ac7cafa807ce337fb9f2c | <ide><path>integration-cli/check_test.go
<ide> func (s *TimerSuite) TearDownTest(c *check.C) {
<ide> fmt.Printf("%-60s%.2f\n", c.TestName(), time.Since(s.start).Seconds())
<ide> }
<ide>
<add>func init() {
<add> check.Suite(&DockerSuite{})
<add>}
<add>
<ide> type DockerSuite struct {
<ide> TimerSuite
<ide> }
<ide> func (s *DockerSuite) TearDownTest(c *check.C) {
<ide> s.TimerSuite.TearDownTest(c)
<ide> }
<ide>
<del>var _ = check.Suite(&DockerSuite{})
<add>func init() {
<add> check.Suite(&DockerRegistrySuite{
<add> ds: &DockerSuite{},
<add> })
<add>}
<add>
<add>type DockerRegistrySuite struct {
<add> ds *DockerSuite
<add> reg *testRegistryV2
<add>}
<add>
<add>func (s *DockerRegistrySuite) SetUpTest(c *check.C) {
<add> s.reg = setupRegistry(c)
<add> s.ds.SetUpTest(c)
<add>}
<add>
<add>func (s *DockerRegistrySuite) TearDownTest(c *check.C) {
<add> s.reg.Close()
<add> s.ds.TearDownTest(c)
<add>}
<ide><path>integration-cli/docker_cli_by_digest_test.go
<ide> func setupImageWithTag(tag string) (string, error) {
<ide> return pushDigest, nil
<ide> }
<ide>
<del>func (s *DockerSuite) TestPullByTagDisplaysDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPullByTagDisplaysDigest(c *check.C) {
<ide> pushDigest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestPullByTagDisplaysDigest(c *check.C) {
<ide> if pushDigest != pullDigest {
<ide> c.Fatalf("push digest %q didn't match pull digest %q", pushDigest, pullDigest)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestPullByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
<ide> pushDigest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestPullByDigest(c *check.C) {
<ide> if pushDigest != pullDigest {
<ide> c.Fatalf("push digest %q didn't match pull digest %q", pushDigest, pullDigest)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestCreateByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
<ide> pushDigest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestCreateByDigest(c *check.C) {
<ide> if res != imageReference {
<ide> c.Fatalf("unexpected Config.Image: %s (expected %s)", res, imageReference)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestRunByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestRunByDigest(c *check.C) {
<ide> pushDigest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestRunByDigest(c *check.C) {
<ide> if res != imageReference {
<ide> c.Fatalf("unexpected Config.Image: %s (expected %s)", res, imageReference)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestRemoveImageByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestRemoveImageByDigest(c *check.C) {
<ide> digest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestRemoveImageByDigest(c *check.C) {
<ide> } else if !strings.Contains(err.Error(), "No such image") {
<ide> c.Fatalf("expected 'No such image' output, got %v", err)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestBuildByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestBuildByDigest(c *check.C) {
<ide> digest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestBuildByDigest(c *check.C) {
<ide> if res != imageID {
<ide> c.Fatalf("Image %s, expected %s", res, imageID)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestTagByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestTagByDigest(c *check.C) {
<ide> digest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestTagByDigest(c *check.C) {
<ide> if tagID != expectedID {
<ide> c.Fatalf("expected image id %q, got %q", expectedID, tagID)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestListImagesWithoutDigests(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestListImagesWithoutDigests(c *check.C) {
<ide> digest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestListImagesWithoutDigests(c *check.C) {
<ide>
<ide> }
<ide>
<del>func (s *DockerSuite) TestListImagesWithDigests(c *check.C) {
<del> defer setupRegistry(c)()
<add>func (s *DockerRegistrySuite) TestListImagesWithDigests(c *check.C) {
<ide>
<ide> // setup image1
<ide> digest1, err := setupImageWithTag("tag1")
<ide> func (s *DockerSuite) TestListImagesWithDigests(c *check.C) {
<ide> if !busyboxRe.MatchString(out) {
<ide> c.Fatalf("expected %q: %s", busyboxRe.String(), out)
<ide> }
<del>
<ide> }
<ide>
<del>func (s *DockerSuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) {
<ide> pushDigest, err := setupImage()
<ide> if err != nil {
<ide> c.Fatalf("error setting up image: %v", err)
<ide> func (s *DockerSuite) TestDeleteImageByIDOnlyPulledByDigest(c *check.C) {
<ide> if _, err := runCommand(cmd); err != nil {
<ide> c.Fatalf("error deleting image by id: %v", err)
<ide> }
<del>
<ide> }
<ide><path>integration-cli/docker_cli_pull_test.go
<ide> import (
<ide> )
<ide>
<ide> // See issue docker/docker#8141
<del>func (s *DockerSuite) TestPullImageWithAliases(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPullImageWithAliases(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
<ide>
<ide> repos := []string{}
<ide> func (s *DockerSuite) TestPullImageWithAliases(c *check.C) {
<ide> c.Fatalf("Image %v shouldn't have been pulled down", repo)
<ide> }
<ide> }
<del>
<ide> }
<ide>
<ide> // pulling library/hello-world should show verified message
<ide><path>integration-cli/docker_cli_push_test.go
<ide> import (
<ide> )
<ide>
<ide> // pulling an image from the central registry should work
<del>func (s *DockerSuite) TestPushBusyboxImage(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPushBusyboxImage(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
<ide> // tag the image to upload it to the private registry
<ide> tagCmd := exec.Command(dockerBinary, "tag", "busybox", repoName)
<ide> func (s *DockerSuite) TestPushUnprefixedRepo(c *check.C) {
<ide> }
<ide> }
<ide>
<del>func (s *DockerSuite) TestPushUntagged(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPushUntagged(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
<ide>
<ide> expected := "Repository does not exist"
<ide> func (s *DockerSuite) TestPushUntagged(c *check.C) {
<ide> }
<ide> }
<ide>
<del>func (s *DockerSuite) TestPushBadTag(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPushBadTag(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox:latest", privateRegistryURL)
<ide>
<ide> expected := "does not exist"
<ide> func (s *DockerSuite) TestPushBadTag(c *check.C) {
<ide> }
<ide> }
<ide>
<del>func (s *DockerSuite) TestPushMultipleTags(c *check.C) {
<del> defer setupRegistry(c)()
<del>
<add>func (s *DockerRegistrySuite) TestPushMultipleTags(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
<ide> repoTag1 := fmt.Sprintf("%v/dockercli/busybox:t1", privateRegistryURL)
<ide> repoTag2 := fmt.Sprintf("%v/dockercli/busybox:t2", privateRegistryURL)
<ide> func (s *DockerSuite) TestPushMultipleTags(c *check.C) {
<ide> }
<ide> }
<ide>
<del>func (s *DockerSuite) TestPushInterrupt(c *check.C) {
<del> defer setupRegistry(c)()
<add>func (s *DockerRegistrySuite) TestPushInterrupt(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/busybox", privateRegistryURL)
<ide> // tag the image and upload it to the private registry
<ide> if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, "tag", "busybox", repoName)); err != nil {
<ide> func (s *DockerSuite) TestPushInterrupt(c *check.C) {
<ide> }
<ide> }
<ide>
<del>func (s *DockerSuite) TestPushEmptyLayer(c *check.C) {
<del> defer setupRegistry(c)()
<add>func (s *DockerRegistrySuite) TestPushEmptyLayer(c *check.C) {
<ide> repoName := fmt.Sprintf("%v/dockercli/emptylayer", privateRegistryURL)
<ide> emptyTarball, err := ioutil.TempFile("", "empty_tarball")
<ide> if err != nil {
<ide><path>integration-cli/docker_utils.go
<ide> func daemonTime(c *check.C) time.Time {
<ide> return dt
<ide> }
<ide>
<del>func setupRegistry(c *check.C) func() {
<add>func setupRegistry(c *check.C) *testRegistryV2 {
<ide> testRequires(c, RegistryHosting)
<ide> reg, err := newTestRegistryV2(c)
<ide> if err != nil {
<ide> func setupRegistry(c *check.C) func() {
<ide> if err != nil {
<ide> c.Fatal("Timeout waiting for test registry to become available")
<ide> }
<del>
<del> return func() { reg.Close() }
<add> return reg
<ide> }
<ide>
<ide> // appendBaseEnv appends the minimum set of environment variables to exec the | 5 |
Text | Text | fix typo in fast refresh documentation | e87b739f335dad7b6f032c95a61f9aaa21ec667d | <ide><path>docs/basic-features/fast-refresh.md
<ide> description:
<ide>
<ide> # Fast Refresh
<ide>
<del>Fast Refresh is a Next.js feature that that gives you instantaneous feedback on
<add>Fast Refresh is a Next.js feature that gives you instantaneous feedback on
<ide> edits made to your React components. Fast Refresh is enabled by default in all
<ide> Next.js applications on **9.4 or newer**. With Next.js Fast Refresh enabled,
<ide> most edits should be visible within a second, **without losing component | 1 |
PHP | PHP | fix route when uncomment $namespace | d3353c9e9a06a044ec573cbf8b73a416e2f2a2ba | <ide><path>app/Providers/RouteServiceProvider.php
<ide> public function boot()
<ide> $this->routes(function () {
<ide> Route::prefix('api')
<ide> ->middleware('api')
<add> ->namespace($this->namespace)
<ide> ->group(base_path('routes/api.php'));
<ide>
<ide> Route::middleware('web')
<add> ->namespace($this->namespace)
<ide> ->group(base_path('routes/web.php'));
<ide> });
<ide> } | 1 |
Javascript | Javascript | require eventemitter via nativemodule | 807acf7f9871c6ee25915e7e159c9ea8b168028b | <ide><path>src/node.js
<ide> if (isSignal(type)) {
<ide> assert(signalWraps.hasOwnProperty(type));
<ide>
<del> if (EventEmitter.listenerCount(this, type) === 0) {
<add> if (NativeModule.require('events').listenerCount(this, type) === 0) {
<ide> signalWraps[type].close();
<ide> delete signalWraps[type];
<ide> } | 1 |
Python | Python | handle copyright in add-new-model-like | 9c8fde8e196294901eb6abc074f735ecd883ef4c | <ide><path>src/transformers/commands/add_new_model_like.py
<ide> import re
<ide> from argparse import ArgumentParser, Namespace
<ide> from dataclasses import dataclass
<add>from datetime import date
<ide> from itertools import chain
<ide> from pathlib import Path
<ide> from typing import Any, Callable, Dict, List, Optional, Pattern, Tuple, Union
<ide> logger = logging.get_logger(__name__) # pylint: disable=invalid-name
<ide>
<ide>
<add>CURRENT_YEAR = date.today().year
<ide> TRANSFORMERS_PATH = Path(__file__).parent.parent
<ide> REPO_PATH = TRANSFORMERS_PATH.parent.parent
<ide>
<ide> def duplicate_module(
<ide> with open(module_file, "r", encoding="utf-8") as f:
<ide> content = f.read()
<ide>
<add> content = re.sub("# Copyright (\d+)\s", f"# Copyright {CURRENT_YEAR} ", content)
<ide> objects = parse_module_content(content)
<ide>
<ide> # Loop and treat all objects
<ide> def duplicate_doc_file(
<ide> with open(doc_file, "r", encoding="utf-8") as f:
<ide> content = f.read()
<ide>
<add> content = re.sub("<!--\s*Copyright (\d+)\s", f"<!--Copyright {CURRENT_YEAR} ", content)
<ide> if frameworks is None:
<ide> frameworks = get_default_frameworks()
<ide> if dest_file is None: | 1 |
PHP | PHP | consider real path of app to handle symlinks | 36275129d710ea385ad5cb611feda6b75e84e4d9 | <ide><path>lib/Cake/Console/Command/Task/ExtractTask.php
<ide> protected function _processValidationRules($field, $rules, $file, $domain) {
<ide> * @return void
<ide> */
<ide> protected function _buildFiles() {
<add> $paths = $this->_paths;
<add> $paths[] = realpath(APP) . DS;
<ide> foreach ($this->_translations as $domain => $translations) {
<ide> foreach ($translations as $msgid => $details) {
<ide> $plural = $details['msgid_plural'];
<ide> protected function _buildFiles() {
<ide> $occurrences[] = $file . ':' . implode(';', $lines);
<ide> }
<ide> $occurrences = implode("\n#: ", $occurrences);
<del> $header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n";
<add> $header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
<ide>
<ide> if ($plural === false) {
<ide> $sentence = "msgid \"{$msgid}\"\n"; | 1 |
Ruby | Ruby | raise deprecation exceptions in tests | 1b4fdc17f4afa716ded74949c1e06ecce838e919 | <ide><path>Library/Homebrew/test/cask/dsl_spec.rb
<ide> def caveats
<ide> end
<ide>
<ide> describe "depends_on macos" do
<del> context "valid", :needs_compat do
<add> context "string disabled", :needs_compat do
<ide> let(:token) { "compat/with-depends-on-macos-string" }
<ide>
<ide> it "allows depends_on macos to be specified" do
<del> expect(cask.depends_on.macos).not_to be nil
<add> expect { cask }.to raise_error(Cask::CaskInvalidError)
<ide> end
<ide> end
<ide>
<ide><path>Library/Homebrew/test/spec_helper.rb
<ide> def find_files
<ide> end
<ide>
<ide> begin
<add> Homebrew.raise_deprecation_exceptions = true
<ide> Tap.clear_cache
<ide> FormulaInstaller.clear_attempted
<ide> | 2 |
Javascript | Javascript | fix error on bad listener type | 1afc0c9e86025693a157df935edbe72d7296055d | <ide><path>lib/fs.js
<ide> StatWatcher.prototype.stop = function() {
<ide>
<ide> const statWatchers = new Map();
<ide>
<del>fs.watchFile = function(filename) {
<add>fs.watchFile = function(filename, options, listener) {
<ide> nullCheck(filename);
<ide> filename = pathModule.resolve(filename);
<ide> var stat;
<del> var listener;
<ide>
<del> var options = {
<add> var defaults = {
<ide> // Poll interval in milliseconds. 5007 is what libev used to use. It's
<ide> // a little on the slow side but let's stick with it for now to keep
<ide> // behavioral changes to a minimum.
<ide> interval: 5007,
<ide> persistent: true
<ide> };
<ide>
<del> if (arguments[1] !== null && typeof arguments[1] === 'object') {
<del> options = util._extend(options, arguments[1]);
<del> listener = arguments[2];
<add> if (options !== null && typeof options === 'object') {
<add> options = util._extend(defaults, options);
<ide> } else {
<del> listener = arguments[1];
<add> listener = options;
<add> options = defaults;
<ide> }
<ide>
<del> if (!listener) {
<add> if (typeof listener !== 'function') {
<ide> throw new Error('watchFile requires a listener function');
<ide> }
<ide>
<ide><path>test/parallel/test-fs-watchfile.js
<add>'use strict';
<add>
<add>const fs = require('fs');
<add>const assert = require('assert');
<add>
<add>// Basic usage tests.
<add>assert.throws(function() {
<add> fs.watchFile('./some-file');
<add>}, /watchFile requires a listener function/);
<add>
<add>assert.throws(function() {
<add> fs.watchFile('./another-file', {}, 'bad listener');
<add>}, /watchFile requires a listener function/);
<add>
<add>assert.throws(function() {
<add> fs.watchFile(new Object(), function() {});
<add>}, /Path must be a string/); | 2 |
Ruby | Ruby | alphabetize tap migrations | 2295c1cc8a093404f6aaca6696baeee6d3b4ec2c | <ide><path>Library/Homebrew/tap_migrations.rb
<ide> "pocl" => "homebrew/science",
<ide> "qfits" => "homebrew/boneyard",
<ide> "qrupdate" => "homebrew/science",
<del> "slicot" => "homebrew/science",
<ide> "shark" => "homebrew/boneyard",
<add> "slicot" => "homebrew/science",
<ide> "solfege" => "homebrew/boneyard",
<ide> "storm" => "homebrew/boneyard",
<ide> "syslog-ng" => "homebrew/boneyard", | 1 |
Python | Python | add extgen subpackage | 2ff91f96ae8ed6c53c5822696e5527f12b9e1e2c | <ide><path>numpy/f2py/lib/setup.py
<ide> def configuration(parent_package='',top_path=None):
<ide> from numpy.distutils.misc_util import Configuration
<ide> config = Configuration('lib',parent_package,top_path)
<ide> config.add_subpackage('parser')
<add> config.add_subpackage('extgen')
<ide> config.add_data_files('*.txt','parser/*.txt')
<ide> config.add_data_dir('src')
<ide> return config | 1 |
Javascript | Javascript | rename $animate.process to $animate.flushnext() | 85d705ab69a89cc5b0c8d2636dede4827d0d8141 | <ide><path>src/ngMock/angular-mocks.js
<ide> angular.mock.animate = angular.module('mock.animate', ['ng'])
<ide> var animate = {
<ide> queue : [],
<ide> enabled : $delegate.enabled,
<del> process : function(name) {
<add> flushNext : function(name) {
<ide> var tick = animate.queue.shift();
<ide> expect(tick.method).toBe(name);
<ide> tick.fn();
<ide><path>test/ng/directive/ngClassSpec.js
<ide> describe('ngClass animations', function() {
<ide>
<ide> $rootScope.val = 'one';
<ide> $rootScope.$digest();
<del> $animate.process('addClass');
<del> $animate.process('addClass');
<add> $animate.flushNext('addClass');
<add> $animate.flushNext('addClass');
<ide> $timeout.flush();
<ide> expect($animate.queue.length).toBe(0);
<ide>
<ide> $rootScope.val = '';
<ide> $rootScope.$digest();
<del> $animate.process('removeClass'); //only removeClass is called
<add> $animate.flushNext('removeClass'); //only removeClass is called
<ide> expect($animate.queue.length).toBe(0);
<ide> $timeout.flush();
<ide>
<ide> $rootScope.val = 'one';
<ide> $rootScope.$digest();
<del> $animate.process('addClass');
<add> $animate.flushNext('addClass');
<ide> $timeout.flush();
<ide> expect($animate.queue.length).toBe(0);
<ide>
<ide> $rootScope.val = 'two';
<ide> $rootScope.$digest();
<del> $animate.process('removeClass');
<del> $animate.process('addClass');
<add> $animate.flushNext('removeClass');
<add> $animate.flushNext('addClass');
<ide> $timeout.flush();
<ide> expect($animate.queue.length).toBe(0);
<ide> }));
<ide><path>test/ng/directive/ngIfSpec.js
<ide> describe('ngIf animations', function () {
<ide> $rootScope.$digest();
<ide> $scope.$apply('value = true');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('Hi');
<ide>
<ide> expect(element.children().length).toBe(1);
<ide> describe('ngIf animations', function () {
<ide> ))($scope);
<ide> $scope.$apply('value = true');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('Hi');
<ide>
<ide> $scope.$apply('value = false');
<ide> expect(element.children().length).toBe(1);
<ide>
<del> item = $animate.process('leave').element;
<add> item = $animate.flushNext('leave').element;
<ide> expect(item.text()).toBe('Hi');
<ide>
<ide> expect(element.children().length).toBe(0);
<ide><path>test/ng/directive/ngIncludeSpec.js
<ide> describe('ngInclude animations', function() {
<ide> ))($rootScope);
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('data');
<ide> }));
<ide>
<ide> describe('ngInclude animations', function() {
<ide> ))($rootScope);
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('data');
<ide>
<ide> $rootScope.tpl = '';
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('leave').element;
<add> item = $animate.flushNext('leave').element;
<ide> expect(item.text()).toBe('data');
<ide> }));
<ide>
<ide> describe('ngInclude animations', function() {
<ide> ))($rootScope);
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('one');
<ide>
<ide> $rootScope.tpl = 'two';
<ide> $rootScope.$digest();
<ide>
<del> var itemA = $animate.process('leave').element;
<del> var itemB = $animate.process('enter').element;
<add> var itemA = $animate.flushNext('leave').element;
<add> var itemB = $animate.flushNext('enter').element;
<ide> expect(itemA.attr('ng-include')).toBe('tpl');
<ide> expect(itemB.attr('ng-include')).toBe('tpl');
<ide> expect(itemA).not.toEqual(itemB);
<ide><path>test/ng/directive/ngRepeatSpec.js
<ide> describe('ngRepeat animations', function() {
<ide> $rootScope.items = ['1','2','3'];
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('1');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('2');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('3');
<ide> }));
<ide>
<ide> describe('ngRepeat animations', function() {
<ide> $rootScope.items = ['1','2','3'];
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('1');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('2');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('3');
<ide>
<ide> $rootScope.items = ['1','3'];
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('leave').element;
<add> item = $animate.flushNext('leave').element;
<ide> expect(item.text()).toBe('2');
<ide> }));
<ide>
<ide> describe('ngRepeat animations', function() {
<ide> $rootScope.items = ['1','2','3'];
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('1');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('2');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('3');
<ide>
<ide> $rootScope.items = ['2','3','1'];
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('move').element;
<add> item = $animate.flushNext('move').element;
<ide> expect(item.text()).toBe('2');
<ide>
<del> item = $animate.process('move').element;
<add> item = $animate.flushNext('move').element;
<ide> expect(item.text()).toBe('1');
<ide> }));
<ide>
<ide><path>test/ng/directive/ngShowHideSpec.js
<ide> describe('ngShow / ngHide animations', function() {
<ide> ))($scope);
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('removeClass').element;
<add> item = $animate.flushNext('removeClass').element;
<ide> expect(item.text()).toBe('data');
<ide> expect(item).toBeShown();
<ide>
<ide> $scope.on = false;
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('addClass').element;
<add> item = $animate.flushNext('addClass').element;
<ide> expect(item.text()).toBe('data');
<ide> expect(item).toBeHidden();
<ide> }));
<ide> describe('ngShow / ngHide animations', function() {
<ide> ))($scope);
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('addClass').element;
<add> item = $animate.flushNext('addClass').element;
<ide> expect(item.text()).toBe('datum');
<ide> expect(item).toBeHidden();
<ide>
<ide> $scope.off = false;
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('removeClass').element;
<add> item = $animate.flushNext('removeClass').element;
<ide> expect(item.text()).toBe('datum');
<ide> expect(item).toBeShown();
<ide> }));
<ide><path>test/ng/directive/ngSwitchSpec.js
<ide> describe('ngSwitch animations', function() {
<ide> $scope.val = 'one';
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('one');
<ide> }));
<ide>
<ide> describe('ngSwitch animations', function() {
<ide> $scope.val = 'two';
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('two');
<ide>
<ide> $scope.val = 'three';
<ide> $scope.$digest();
<ide>
<del> item = $animate.process('leave').element;
<add> item = $animate.flushNext('leave').element;
<ide> expect(item.text()).toBe('two');
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('three');
<ide> }));
<ide>
<ide><path>test/ngRoute/directive/ngViewSpec.js
<ide> describe('ngView animations', function() {
<ide> $location.path('/foo');
<ide> $rootScope.$digest();
<ide>
<del> var item = $animate.process('enter').element;
<add> var item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('data');
<ide> }));
<ide>
<ide> describe('ngView animations', function() {
<ide> $location.path('/foo');
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('foo');
<ide>
<ide> $location.path('/');
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('leave').element;
<add> item = $animate.flushNext('leave').element;
<ide> expect(item.text()).toBe('foo');
<ide> }));
<ide>
<ide> describe('ngView animations', function() {
<ide> $location.path('/foo');
<ide> $rootScope.$digest();
<ide>
<del> item = $animate.process('enter').element;
<add> item = $animate.flushNext('enter').element;
<ide> expect(item.text()).toBe('data');
<ide>
<ide> $location.path('/bar');
<ide> $rootScope.$digest();
<ide>
<del> var itemA = $animate.process('leave').element;
<add> var itemA = $animate.flushNext('leave').element;
<ide> expect(itemA).not.toEqual(itemB);
<del> var itemB = $animate.process('enter').element;
<add> var itemB = $animate.flushNext('enter').element;
<ide> }));
<ide> });
<ide>
<ide> describe('ngView animations', function() {
<ide> $location.path('/foo');
<ide> $rootScope.$digest();
<ide>
<del> $animate.process('enter'); //ngView
<add> $animate.flushNext('enter'); //ngView
<ide>
<ide> $timeout.flush();
<ide>
<del> $animate.process('enter'); //repeat 1
<del> $animate.process('enter'); //repeat 2
<add> $animate.flushNext('enter'); //repeat 1
<add> $animate.flushNext('enter'); //repeat 2
<ide>
<ide> $timeout.flush();
<ide>
<ide> describe('ngView animations', function() {
<ide> $location.path('/bar');
<ide> $rootScope.$digest();
<ide>
<del> $animate.process('leave'); //ngView old
<add> $animate.flushNext('leave'); //ngView old
<ide> $timeout.flush();
<ide>
<del> $animate.process('enter'); //ngView new
<add> $animate.flushNext('enter'); //ngView new
<ide> $timeout.flush();
<ide>
<ide> expect(n(element.text())).toEqual(''); //this is midway during the animation
<ide>
<del> $animate.process('enter'); //ngRepeat 3
<del> $animate.process('enter'); //ngRepeat 4
<add> $animate.flushNext('enter'); //ngRepeat 3
<add> $animate.flushNext('enter'); //ngRepeat 4
<ide>
<ide> $timeout.flush();
<ide> | 8 |
Text | Text | add changelog metadata for url.format | 6e79076feeb04a18253c0dc623307523819142d3 | <ide><path>doc/api/url.md
<ide> forward-slash characters (`/`) are required following the colon in the
<ide> ### url.format(urlObject)
<ide> <!-- YAML
<ide> added: v0.1.25
<add>changes:
<add> - version: v7.0.0
<add> pr-url: https://github.com/nodejs/node/pull/7234
<add> description: URLs with a `file:` scheme will now always use the correct
<add> number of slashes regardless of `slashes` option. A false-y
<add> `slashes` option with no protocol is now also respected at all
<add> times.
<ide> -->
<ide>
<ide> * `urlObject` {Object|string} A URL object (as returned by `url.parse()` or | 1 |
Text | Text | fix a minor typo | 822ea6057b555ec714c54a6bbb0758a4482f29fb | <ide><path>share/doc/homebrew/Analytics.md
<ide> Homebrew's analytics are accessible to Homebrew's current maintainers. Contact @
<ide> The code is viewable in https://github.com/Homebrew/brew/blob/master/Library/Homebrew/utils/analytics.rb and https://github.com/Homebrew/brew/blob/master/Library/Homebrew/utils/analytics.sh. They are done in a separate background process and fail fast to avoid delaying any execution. They will fail immediately and silently if you have no network connection.
<ide>
<ide> ## Opting-out
<del>If after everything you've read you still wish to opt-out of Homebrew's analytics you may set `HOMEBREW_NO_ANALYTICS=1` in your environment or run `git config --file="$(brew --repository)/.git/config" --replace-all homebrew.analyticsdisabled true` which will prevent analytics from ever being sent when either or them have been set.
<add>If after everything you've read you still wish to opt-out of Homebrew's analytics you may set `HOMEBREW_NO_ANALYTICS=1` in your environment or run `git config --file="$(brew --repository)/.git/config" --replace-all homebrew.analyticsdisabled true` which will prevent analytics from ever being sent when either of them have been set. | 1 |
Go | Go | implement create veth | 2d2c237f50b7954993f6cd1db67c6f8c6d06f881 | <ide><path>pkg/netlink/netlink_linux.go
<ide> func rtaAlignOf(attrlen int) int {
<ide>
<ide> type RtAttr struct {
<ide> syscall.RtAttr
<del> Data []byte
<add> Data []byte
<add> children []*RtAttr
<add> prefix int
<ide> }
<ide>
<ide> func newRtAttr(attrType int, data []byte) *RtAttr {
<del> attr := &RtAttr{}
<add> attr := &RtAttr{
<add> children: []*RtAttr{},
<add> }
<ide> attr.Type = uint16(attrType)
<ide> attr.Data = data
<ide>
<ide> return attr
<ide> }
<ide>
<del>func (attr *RtAttr) ToWireFormat() []byte {
<add>func newRtAttrChild(parent *RtAttr, attrType int, data []byte) *RtAttr {
<add> attr := newRtAttr(attrType, data)
<add> parent.children = append(parent.children, attr)
<add> return attr
<add>}
<add>
<add>func (a *RtAttr) length() int {
<add> l := 0
<add> for _, child := range a.children {
<add> l += child.length() + syscall.SizeofRtAttr + child.prefix
<add> }
<add> if l == 0 {
<add> l++
<add> }
<add> return rtaAlignOf(l + len(a.Data))
<add>}
<add>
<add>func (a *RtAttr) ToWireFormat() []byte {
<ide> native := nativeEndian()
<ide>
<del> len := syscall.SizeofRtAttr + len(attr.Data)
<del> b := make([]byte, rtaAlignOf(len))
<del> native.PutUint16(b[0:2], uint16(len))
<del> native.PutUint16(b[2:4], attr.Type)
<del> for i, d := range attr.Data {
<del> b[4+i] = d
<add> length := a.length()
<add> buf := make([]byte, rtaAlignOf(length+syscall.SizeofRtAttr))
<add>
<add> if a.Data != nil {
<add> copy(buf[4:], a.Data)
<add> } else {
<add> next := 4
<add> for _, child := range a.children {
<add> childBuf := child.ToWireFormat()
<add> copy(buf[next+child.prefix:], childBuf)
<add> next += rtaAlignOf(len(childBuf))
<add> }
<ide> }
<ide>
<del> return b
<add> if l := uint16(rtaAlignOf(length)); l != 0 {
<add> native.PutUint16(buf[0:2], l+1)
<add> }
<add> native.PutUint16(buf[2:4], a.Type)
<add>
<add> return buf
<ide> }
<ide>
<ide> type NetlinkRequest struct {
<ide> func NetworkLinkAddIp(iface *net.Interface, ip net.IP, ipNet *net.IPNet) error {
<ide> }
<ide>
<ide> func zeroTerminated(s string) []byte {
<del> bytes := make([]byte, len(s)+1)
<del> for i := 0; i < len(s); i++ {
<del> bytes[i] = s[i]
<del> }
<del> bytes[len(s)] = 0
<del> return bytes
<add> return []byte(s + "\000")
<ide> }
<ide>
<ide> func nonZeroTerminated(s string) []byte {
<ide> func NetworkCreateVethPair(name1, name2 string) error {
<ide> msg := newIfInfomsg(syscall.AF_UNSPEC)
<ide> wb.AddData(msg)
<ide>
<del> kindData := newRtAttr(IFLA_INFO_KIND, nonZeroTerminated("veth"))
<del> info := newRtAttr(syscall.IFLA_LINKINFO, kindData.ToWireFormat())
<del> // wb.AddData(info)
<del>
<del> peerName := newRtAttr(syscall.IFLA_IFNAME, nonZeroTerminated(name2))
<del> peer := newRtAttr(VETH_PEER, peerName.ToWireFormat())
<del> // wb.AddData(peer)
<add> nameData := newRtAttr(syscall.IFLA_IFNAME, zeroTerminated(name1))
<add> wb.AddData(nameData)
<ide>
<del> b := []byte{}
<del> b = append(b, peer.ToWireFormat()...)
<del> b = append(b, info.ToWireFormat()...)
<add> nest1 := newRtAttr(syscall.IFLA_LINKINFO, nil)
<add> newRtAttrChild(nest1, IFLA_INFO_KIND, zeroTerminated("veth"))
<add> nest2 := newRtAttrChild(nest1, IFLA_INFO_DATA, nil)
<add> nest3 := newRtAttrChild(nest2, VETH_PEER, nil)
<ide>
<del> infoData := newRtAttr(IFLA_INFO_DATA, b)
<del> wb.AddData(infoData)
<add> last := newRtAttrChild(nest3, syscall.IFLA_IFNAME, zeroTerminated(name2))
<add> last.prefix = syscall.SizeofIfInfomsg
<ide>
<del> nameData := newRtAttr(syscall.IFLA_IFNAME, zeroTerminated(name1))
<del> wb.AddData(nameData)
<add> wb.AddData(nest1)
<ide>
<ide> if err := s.Send(wb); err != nil {
<ide> return err | 1 |
Text | Text | fix links and typos | c1ad0b9a1386b7a06483699e1d6f8c15788eaff3 | <ide><path>guide/english/user-experience-design/index.md
<ide> This section, and its guides, will cover a wide variety of user experience desig
<ide>
<ide> #### Articles, Resources and Inspiration for User Experience Design
<ide>
<del> <a href='https://www.prototypr.io/home/' target='_blank' rel='nofollow'>Prtotypr.io</a>
<del>[Prototypr.io] (https://www.prototypr.io/home/)
<add>[Prototypr.io](https://www.prototypr.io/home/)
<ide>
<del> <a href='https://uxplanet.org/' target='_blank' rel='nofollow'>UX Planet</a>
<del>[UX Planet] (https://uxplanet.org/)
<add>[UX Planet](https://uxplanet.org/)
<ide>
<del> <a href='https://uxdesign.cc/' target='_blank' rel='nofollow'>UX Collective</a>
<del>[UX Collective] (https://uxdesign.cc/)
<add>[UX Collective](https://uxdesign.cc/)
<ide>
<ide> <a href='https://medium.com/google-design/tagged/ux' target='_blank' rel='nofollow'>Google Design on Medium</a>
<del>[Google Design on Medium] (https://medium.com/google-design/tagged/ux)
<add>[Google Design on Medium](https://medium.com/google-design/tagged/ux)
<ide>
<ide> <a href='https://medium.com/@pablostanley' taget='_blank' rel='nofollow'>Pablo Stanley</a>
<del>[Pablo Stanley on Medium] (https://medium.com/@pablostanley)
<add>[Pablo Stanley on Medium](https://medium.com/@pablostanley)
<ide>
<ide> [Boxes & Arrows](http://boxesandarrows.com)
<ide> [Usabilla](http://blog.usabilla.com)
<ide>
<ide> #### Textbook for User Experience Design
<del> The Design of Everyday Things: Revised and Expanded Edition -> (Amazon)[https://www.amazon.com/Design-Everyday-Things-Revised-Expanded/dp/0465050654/ref=sr_1_1?ie=UTF8&qid=1538897807&sr=8-1&keywords=design+of+everyday+things]
<add> [The Design of Everyday Things: Revised and Expanded Edition -> [Amazon](https://www.amazon.com/Design-Everyday-Things-Revised-Expanded/dp/0465050654/)
<ide>
<del> Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability (3rd Edition) -> (Amazon)[https://www.amazon.com/Dont-Make-Think-Revisited-Usability/dp/0321965515/ref=sr_1_1?ie=UTF8&qid=1538897464&sr=8-1&keywords=don%27t+make+me+think]
<add> [Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability (3rd Edition) -> (Amazon)](https://www.amazon.com/Dont-Make-Think-Revisited-Usability/dp/0321965515/)
<ide>
<del>Interaction Design: beyond human computer interaction 4th edition -> (Amazon)[https://www.amazon.com/Interaction-Design-Beyond-Human-Computer/dp/1119020751]
<add>[Interaction Design: beyond human computer interaction 4th edition -> (Amazon)](https://www.amazon.com/Interaction-Design-Beyond-Human-Computer/dp/1119020751)
<ide>
<ide> #### Mostly Free Online UX Design Curriculum
<ide> | 1 |
Text | Text | remove reference to sslv3 in tls.md | d2fcd1dd392ae3f32054f0343d750251b842a314 | <ide><path>doc/api/tls.md
<ide> be returned for server sockets or disconnected client sockets.
<ide>
<ide> Example responses include:
<ide>
<del>* `SSLv3`
<ide> * `TLSv1`
<ide> * `TLSv1.1`
<ide> * `TLSv1.2` | 1 |
Python | Python | add project_urls to setup.py | 1256d5363def76aac271cc3903a80ab723b78ea6 | <ide><path>setup.py
<ide> def get_version(package):
<ide> 'Programming Language :: Python :: 3.7',
<ide> 'Programming Language :: Python :: 3 :: Only',
<ide> 'Topic :: Internet :: WWW/HTTP',
<del> ]
<add> ],
<add> project_urls={
<add> 'Funding': 'https://fund.django-rest-framework.org/topics/funding/',
<add> 'Source': 'https://github.com/encode/django-rest-framework',
<add> },
<ide> )
<ide>
<ide> # (*) Please direct queries to the discussion group, rather than to me directly | 1 |
Javascript | Javascript | fix tilingpattern + implement dummyshading ir form | 755399a755f6c603fa8f052687aa317cacd369d8 | <ide><path>pdf.js
<ide> var PartialEvaluator = (function() {
<ide> var codeIR = this.getIRQueue(pattern, xref,
<ide> dict.get('Resources'), {}, fonts, images, uniquePrefix);
<ide>
<del> args = TilingPattern.getIR(codeIR, dict);
<add> args = TilingPattern.getIR(codeIR, dict, args);
<ide> }
<ide> // Type2 is ShadingPattern.
<ide> else if (typeNum == 2) {
<ide> var CanvasGraphics = (function() {
<ide> if (IR[0] == "TilingPatternIR") {
<ide> // First, build the `color` var like it's done in the
<ide> // Pattern.prototype.parse function.
<add> var args = IR[1];
<ide> var base = cs.base;
<ide> var color;
<ide> if (base) {
<ide> var CanvasGraphics = (function() {
<ide>
<ide> // Build the pattern based on the IR data.
<ide> var pattern = new TilingPatternIR(IR, color, this.ctx);
<del> } else if (IR[0] == "RadialAxialShading") {
<add> } else if (IR[0] == "RadialAxialShading" || IR[0] == "DummyShading") {
<ide> var pattern = Pattern.shadingFromIR(this.ctx, IR);
<ide> } else {
<ide> throw "Unkown IR type";
<ide> var SeparationCS = (function() {
<ide>
<ide> constructor.prototype = {
<ide> getRgb: function sepcs_getRgb(color) {
<del> var tinted = this.tintFn.func(color);
<add> var tinted = this.tintFn(color);
<ide> return this.base.getRgb(tinted);
<ide> },
<ide> getRgbBuffer: function sepcs_getRgbBuffer(input, bits) {
<ide> var SeparationCS = (function() {
<ide> var baseBuf = new Uint8Array(numComps * length);
<ide> for (var i = 0; i < length; ++i) {
<ide> var scaled = input[i] * scale;
<del> var tinted = tintFn.func([scaled]);
<add> var tinted = tintFn([scaled]);
<ide> for (var j = 0; j < numComps; ++j)
<ide> baseBuf[pos++] = 255 * tinted[j];
<ide> }
<ide> var DummyShading = (function() {
<ide> function constructor() {
<ide> this.type = 'Pattern';
<ide> }
<add>
<add> constructor.fromIR = function() {
<add> return 'hotpink';
<add> }
<add>
<ide> constructor.prototype = {
<del> getPattern: function dummy_getpattern() {
<del> return 'hotpink';
<add> getIR: function dummpy_getir() {
<add> return [ 'DummyShading' ];
<ide> }
<ide> };
<ide> return constructor;
<ide> var RadialAxialShading = (function() {
<ide> this.type = 'Pattern';
<ide>
<ide> this.ctx = ctx;
<del>
<ide> var cs = dict.get('ColorSpace', 'CS');
<ide> cs = ColorSpace.parse(cs, xref, res);
<ide> this.cs = cs;
<ide> var TilingPatternIR = (function() {
<ide>
<ide> function TilingPatternIR(IR, color, ctx) {
<ide> // "Unfolding" the IR.
<del> var IRQueue = IR[1];
<del> this.matrix = IR[2];
<del> var bbox = IR[3];
<del> var xstep = IR[4];
<del> var ystep = IR[5];
<del> var paintType = IR[6];
<add> var IRQueue = IR[2];
<add> this.matrix = IR[3];
<add> var bbox = IR[4];
<add> var xstep = IR[5];
<add> var ystep = IR[6];
<add> var paintType = IR[7];
<ide>
<ide> //
<ide> TODO('TilingType');
<ide> var TilingPatternIR = (function() {
<ide> })();
<ide>
<ide> var TilingPattern = {
<del> getIR: function(codeIR, dict) {
<add> getIR: function(codeIR, dict, args) {
<ide> var matrix = dict.get('Matrix');
<ide> var bbox = dict.get('BBox');
<ide> var xstep = dict.get('XStep');
<ide> var ystep = dict.get('YStep');
<ide> var paintType = dict.get('PaintType');
<ide>
<del> return ["TilingPatternIR", codeIR, matrix, bbox, xstep, ystep, paintType];
<add> return ["TilingPatternIR", args, codeIR, matrix, bbox, xstep, ystep, paintType];
<ide> }
<ide> };
<ide>
<ide> var PDFFunction = (function() {
<ide> var v2 = rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
<ide>
<ide> // call the appropropriate function
<del> return fns[i].func([v2]);
<add> return fns[i]([v2]);
<ide> };
<ide> },
<ide>
<ide> constructPostScript: function() {
<ide> return [ CONSTRUCT_POSTSCRIPT ];
<ide> },
<ide>
<del> constructPostScriptFromIR: function(IR) {
<add> constructPostScriptFromIR: function() {
<ide> TODO('unhandled type of function');
<del> this.func = function() {
<add> return function() {
<ide> return [255, 105, 180];
<ide> };
<ide> } | 1 |
Ruby | Ruby | add colored output to the new test reporter | 7fa3a0c90a02d198d6058fb29507564539abdd6a | <ide><path>railties/lib/rails/test_unit/minitest_plugin.rb
<ide> def self.plugin_rails_options(opts, options)
<ide> options[:fail_fast] = true
<ide> end
<ide>
<add> opts.on("-c", "--[no-]color",
<add> "Enable color in the output") do |value|
<add> options[:color] = value
<add> end
<add>
<add> options[:color] = true
<ide> options[:output_inline] = true
<ide> options[:patterns] = opts.order!
<ide> end
<ide> def self.plugin_rails_init(options)
<ide> # Disable the extra failure output after a run, unless output is deferred.
<ide> self.hide_aggregated_results = options[:output_inline]
<ide>
<add> self.reporter.reporters.clear
<add> self.reporter << SummaryReporter.new(options[:io], options)
<ide> self.reporter << ::Rails::TestUnitReporter.new(options[:io], options)
<ide> end
<ide>
<ide><path>railties/lib/rails/test_unit/reporter.rb
<ide> class TestUnitReporter < Minitest::StatisticsReporter
<ide> class_attribute :executable
<ide> self.executable = "bin/rails test"
<ide>
<add> COLOR_CODES_FOR_RESULTS = {
<add> "." => :green,
<add> "E" => :red,
<add> "F" => :red,
<add> "S" => :yellow
<add> }
<add>
<add> COLOR_CODES = {
<add> red: 31,
<add> green: 32,
<add> yellow: 33,
<add> blue: 34
<add> }
<add>
<ide> def record(result)
<ide> super
<add> color = COLOR_CODES_FOR_RESULTS[result.result_code]
<add>
<add> if options[:verbose]
<add> io.puts color(format_line(result), color)
<add> else
<add> io.print color(result.result_code, color)
<add> end
<ide>
<ide> if output_inline? && result.failure && (!result.skipped? || options[:verbose])
<ide> io.puts
<ide> io.puts
<del> io.puts format_failures(result)
<add> io.puts format_failures(result).map { |line| color(line, :red) }
<ide> io.puts
<ide> io.puts format_rerun_snippet(result)
<ide> io.puts
<ide> def fail_fast?
<ide> options[:fail_fast]
<ide> end
<ide>
<add> def format_line(result)
<add> "%s#%s = %.2f s = %s" % [result.class, result.name, result.time, result.result_code]
<add> end
<add>
<ide> def format_failures(result)
<ide> result.failures.map do |failure|
<ide> "#{failure.result_label}:\n#{result.class}##{result.name}:\n#{failure.message}\n"
<ide> def format_rerun_snippet(result)
<ide> def app_root
<ide> @app_root ||= defined?(ENGINE_ROOT) ? ENGINE_ROOT : Rails.root
<ide> end
<add>
<add> def colored_output?
<add> options[:color] && io.respond_to?(:tty?) && io.tty?
<add> end
<add>
<add> def color(string, color)
<add> if colored_output?
<add> color = COLOR_CODES[color]
<add> "\e[#{color}m#{string}\e[0m"
<add> else
<add> string
<add> end
<add> end
<ide> end
<ide> end
<ide><path>railties/test/test_unit/reporter_test.rb
<ide> require 'abstract_unit'
<ide> require 'rails/test_unit/reporter'
<add>require 'minitest/mock'
<ide>
<ide> class TestUnitReporterTest < ActiveSupport::TestCase
<ide> class ExampleTest < Minitest::Test
<ide> def woot; end
<ide> @reporter.record(failed_test)
<ide> @reporter.report
<ide>
<del> expect = %r{\A\n\nFailure:\nTestUnitReporterTest::ExampleTest#woot:\nboo\n\nbin/rails test test/test_unit/reporter_test.rb:\d+\n\n\z}
<add> expect = %r{\AF\n\nFailure:\nTestUnitReporterTest::ExampleTest#woot:\nboo\n\nbin/rails test test/test_unit/reporter_test.rb:\d+\n\n\z}
<ide> assert_match expect, @output.string
<ide> end
<ide>
<ide> test "outputs errors inline" do
<ide> @reporter.record(errored_test)
<ide> @reporter.report
<ide>
<del> expect = %r{\A\n\nError:\nTestUnitReporterTest::ExampleTest#woot:\nArgumentError: wups\n No backtrace\n\nbin/rails test .*test/test_unit/reporter_test.rb:6\n\n\z}
<add> expect = %r{\AE\n\nError:\nTestUnitReporterTest::ExampleTest#woot:\nArgumentError: wups\n No backtrace\n\nbin/rails test .*test/test_unit/reporter_test.rb:\d+\n\n\z}
<ide> assert_match expect, @output.string
<ide> end
<ide>
<ide> def woot; end
<ide> verbose.record(skipped_test)
<ide> verbose.report
<ide>
<del> expect = %r{\A\n\nSkipped:\nTestUnitReporterTest::ExampleTest#woot:\nskipchurches, misstemples\n\nbin/rails test test/test_unit/reporter_test.rb:\d+\n\n\z}
<add> expect = %r{\ATestUnitReporterTest::ExampleTest#woot = 10\.00 s = S\n\n\nSkipped:\nTestUnitReporterTest::ExampleTest#woot:\nskipchurches, misstemples\n\nbin/rails test test/test_unit/reporter_test.rb:\d+\n\n\z}
<ide> assert_match expect, @output.string
<ide> end
<ide>
<ide> def woot; end
<ide> assert_no_match 'Failed tests:', @output.string
<ide> end
<ide>
<add> test "outputs colored passing results" do
<add> @output.stub(:tty?, true) do
<add> colored = Rails::TestUnitReporter.new @output, color: true, output_inline: true
<add> colored.record(passing_test)
<add>
<add> expect = %r{\e\[32m\.\e\[0m}
<add> assert_match expect, @output.string
<add> end
<add> end
<add>
<add> test "outputs colored skipped results" do
<add> @output.stub(:tty?, true) do
<add> colored = Rails::TestUnitReporter.new @output, color: true, output_inline: true
<add> colored.record(skipped_test)
<add>
<add> expect = %r{\e\[33mS\e\[0m}
<add> assert_match expect, @output.string
<add> end
<add> end
<add>
<add> test "outputs colored failed results" do
<add> @output.stub(:tty?, true) do
<add> colored = Rails::TestUnitReporter.new @output, color: true, output_inline: true
<add> colored.record(errored_test)
<add>
<add> expected = %r{\e\[31mE\e\[0m\n\n\e\[31mError:\nTestUnitReporterTest::ExampleTest#woot:\nArgumentError: wups\n No backtrace\n\e\[0m}
<add> assert_match expected, @output.string
<add> end
<add> end
<add>
<ide> private
<ide> def assert_rerun_snippet_count(snippet_count)
<ide> assert_equal snippet_count, @output.string.scan(%r{^bin/rails test }).size
<ide> def skipped_test
<ide> rescue Minitest::Assertion => e
<ide> e
<ide> end
<add> st.time = 10
<ide> st
<ide> end
<ide> end | 3 |
Ruby | Ruby | ignore build deps when built from src | ae17d3cffd6ad1c7c855f456190e1474f8b774ff | <ide><path>Library/Homebrew/cmd/leaves.rb
<ide> def installed_as_dependency?(formula)
<ide> def leaves
<ide> args = leaves_args.parse
<ide>
<del> leaves_list = Formula.formulae_with_no_formula_dependents(Formula.installed)
<add> leaves_list = Formula.installed - Formula.installed.flat_map(&:runtime_formula_dependencies)
<ide>
<ide> leaves_list.select!(&method(:installed_on_request?)) if args.installed_on_request?
<ide> leaves_list.select!(&method(:installed_as_dependency?)) if args.installed_as_dependency?
<ide><path>Library/Homebrew/formula.rb
<ide> def self.formulae_with_cask_dependents(casks)
<ide> .flat_map { |f| [f, *f.runtime_formula_dependencies].compact }
<ide> end
<ide>
<del> # An array of all installed {Formula} without {Formula} dependents
<add> # An array of all installed {Formula} without runtime {Formula}
<add> # dependents for bottles and without build {Formula} dependents
<add> # for those built from source.
<ide> # @private
<ide> def self.formulae_with_no_formula_dependents(formulae)
<ide> return [] if formulae.blank?
<ide>
<del> formulae - formulae.flat_map(&:runtime_formula_dependencies)
<add> formulae - formulae.each_with_object([]) do |formula, dependents|
<add> dependents.concat(formula.runtime_formula_dependencies)
<add>
<add> # Include build dependencies when the formula is not a bottle
<add> unless Tab.for_keg(formula.any_installed_keg).poured_from_bottle
<add> dependents.concat(formula.deps.select(&:build?).map(&:to_formula))
<add> end
<add> end
<ide> end
<ide>
<ide> # Recursive function that returns an array of {Formula} without | 2 |
Text | Text | use consistent method symbol | f095b195c26be07b75d8f9b8945ca1e2aeed8c85 | <ide><path>doc/api/http2.md
<ide> changes:
<ide> queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all
<ide> counted towards the current limit. **Default:** `10`.
<ide> * `maxHeaderListPairs` {number} Sets the maximum number of header entries.
<del> This is similar to [`http.Server#maxHeadersCount`][] or
<del> [`http.ClientRequest#maxHeadersCount`][]. The minimum value is `4`.
<del> **Default:** `128`.
<add> This is similar to [`server.maxHeadersCount`][] or
<add> [`request.maxHeadersCount`][] in the `node:http` module. The minimum value
<add> is `4`. **Default:** `128`.
<ide> * `maxOutstandingPings` {number} Sets the maximum number of outstanding,
<ide> unacknowledged pings. **Default:** `10`.
<ide> * `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a
<ide> changes:
<ide> queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all
<ide> counted towards the current limit. **Default:** `10`.
<ide> * `maxHeaderListPairs` {number} Sets the maximum number of header entries.
<del> This is similar to [`http.Server#maxHeadersCount`][] or
<del> [`http.ClientRequest#maxHeadersCount`][]. The minimum value is `4`.
<del> **Default:** `128`.
<add> This is similar to [`server.maxHeadersCount`][] or
<add> [`request.maxHeadersCount`][] in the `node:http` module. The minimum value
<add> is `4`. **Default:** `128`.
<ide> * `maxOutstandingPings` {number} Sets the maximum number of outstanding,
<ide> unacknowledged pings. **Default:** `10`.
<ide> * `maxSendHeaderBlockLength` {number} Sets the maximum allowed size for a
<ide> changes:
<ide> queued to be sent, and unacknowledged `PING` and `SETTINGS` frames are all
<ide> counted towards the current limit. **Default:** `10`.
<ide> * `maxHeaderListPairs` {number} Sets the maximum number of header entries.
<del> This is similar to [`http.Server#maxHeadersCount`][] or
<del> [`http.ClientRequest#maxHeadersCount`][]. The minimum value is `1`.
<del> **Default:** `128`.
<add> This is similar to [`server.maxHeadersCount`][] or
<add> [`request.maxHeadersCount`][] in the `node:http` module. The minimum value
<add> is `1`. **Default:** `128`.
<ide> * `maxOutstandingPings` {number} Sets the maximum number of outstanding,
<ide> unacknowledged pings. **Default:** `10`.
<ide> * `maxReservedRemoteStreams` {number} Sets the maximum number of reserved push
<ide> you need to implement any fall-back behavior yourself.
<ide> [`Http2Stream`]: #class-http2stream
<ide> [`ServerHttp2Stream`]: #class-serverhttp2stream
<ide> [`TypeError`]: errors.md#class-typeerror
<del>[`http.ClientRequest#maxHeadersCount`]: http.md#requestmaxheaderscount
<del>[`http.Server#maxHeadersCount`]: http.md#servermaxheaderscount
<ide> [`http2.SecureServer`]: #class-http2secureserver
<ide> [`http2.Server`]: #class-http2server
<ide> [`http2.createSecureServer()`]: #http2createsecureserveroptions-onrequesthandler
<ide> you need to implement any fall-back behavior yourself.
<ide> [`net.connect()`]: net.md#netconnect
<ide> [`net.createServer()`]: net.md#netcreateserveroptions-connectionlistener
<ide> [`request.authority`]: #requestauthority
<add>[`request.maxHeadersCount`]: http.md#requestmaxheaderscount
<ide> [`request.socket.getPeerCertificate()`]: tls.md#tlssocketgetpeercertificatedetailed
<ide> [`request.socket`]: #requestsocket
<ide> [`response.end()`]: #responseenddata-encoding-callback
<ide> you need to implement any fall-back behavior yourself.
<ide> [`response.write(data, encoding)`]: http.md#responsewritechunk-encoding-callback
<ide> [`response.writeContinue()`]: #responsewritecontinue
<ide> [`response.writeHead()`]: #responsewriteheadstatuscode-statusmessage-headers
<add>[`server.maxHeadersCount`]: http.md#servermaxheaderscount
<ide> [`tls.Server.close()`]: tls.md#serverclosecallback
<ide> [`tls.TLSSocket`]: tls.md#class-tlstlssocket
<ide> [`tls.connect()`]: tls.md#tlsconnectoptions-callback
<ide><path>doc/api/https.md
<ide> added: v0.1.90
<ide> * `callback` {Function}
<ide> * Returns: {https.Server}
<ide>
<del>See [`http.Server.close()`][].
<add>See [`server.close()`][] in the `node:http` module.
<ide>
<ide> ### `server.closeAllConnections()`
<ide>
<ide> <!-- YAML
<ide> added: REPLACEME
<ide> -->
<ide>
<del>See [`http.Server.closeAllConnections()`][].
<add>See [`server.closeAllConnections()`][] in the `node:http` module.
<ide>
<ide> ### `server.closeIdleConnections()`
<ide>
<ide> <!-- YAML
<ide> added: REPLACEME
<ide> -->
<ide>
<del>See [`http.Server.closeIdleConnections()`][].
<add>See [`server.closeIdleConnections()`][] in the `node:http` module.
<ide>
<ide> ### `server.headersTimeout`
<ide>
<ide> added: v11.3.0
<ide>
<ide> * {number} **Default:** `60000`
<ide>
<del>See [`http.Server#headersTimeout`][].
<add>See [`server.headersTimeout`][] in the `node:http` module.
<ide>
<ide> ### `server.listen()`
<ide>
<ide> This method is identical to [`server.listen()`][] from [`net.Server`][].
<ide>
<ide> * {number} **Default:** `2000`
<ide>
<del>See [`http.Server#maxHeadersCount`][].
<add>See [`server.maxHeadersCount`][] in the `node:http` module.
<ide>
<ide> ### `server.requestTimeout`
<ide>
<ide> added: v14.11.0
<ide>
<ide> * {number} **Default:** `0`
<ide>
<del>See [`http.Server#requestTimeout`][].
<add>See [`server.requestTimeout`][] in the `node:http` module.
<ide>
<ide> ### `server.setTimeout([msecs][, callback])`
<ide>
<ide> added: v0.11.2
<ide> * `callback` {Function}
<ide> * Returns: {https.Server}
<ide>
<del>See [`http.Server#setTimeout()`][].
<add>See [`server.setTimeout()`][] in the `node:http` module.
<ide>
<ide> ### `server.timeout`
<ide>
<ide> changes:
<ide>
<ide> * {number} **Default:** 0 (no timeout)
<ide>
<del>See [`http.Server#timeout`][].
<add>See [`server.timeout`][] in the `node:http` module.
<ide>
<ide> ### `server.keepAliveTimeout`
<ide>
<ide> added: v8.0.0
<ide>
<ide> * {number} **Default:** `5000` (5 seconds)
<ide>
<del>See [`http.Server#keepAliveTimeout`][].
<add>See [`server.keepAliveTimeout`][] in the `node:http` module.
<ide>
<ide> ## `https.createServer([options][, requestListener])`
<ide>
<ide> headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p
<ide> [`http.Agent(options)`]: http.md#new-agentoptions
<ide> [`http.Agent`]: http.md#class-httpagent
<ide> [`http.ClientRequest`]: http.md#class-httpclientrequest
<del>[`http.Server#headersTimeout`]: http.md#serverheaderstimeout
<del>[`http.Server#keepAliveTimeout`]: http.md#serverkeepalivetimeout
<del>[`http.Server#maxHeadersCount`]: http.md#servermaxheaderscount
<del>[`http.Server#requestTimeout`]: http.md#serverrequesttimeout
<del>[`http.Server#setTimeout()`]: http.md#serversettimeoutmsecs-callback
<del>[`http.Server#timeout`]: http.md#servertimeout
<del>[`http.Server.close()`]: http.md#serverclosecallback
<del>[`http.Server.closeAllConnections()`]: http.md#servercloseallconnections
<del>[`http.Server.closeIdleConnections()`]: http.md#servercloseidleconnections
<ide> [`http.Server`]: http.md#class-httpserver
<ide> [`http.createServer()`]: http.md#httpcreateserveroptions-requestlistener
<ide> [`http.get()`]: http.md#httpgetoptions-callback
<ide> headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; p
<ide> [`import()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#dynamic_imports
<ide> [`net.Server`]: net.md#class-netserver
<ide> [`new URL()`]: url.md#new-urlinput-base
<add>[`server.close()`]: http.md#serverclosecallback
<add>[`server.closeAllConnections()`]: http.md#servercloseallconnections
<add>[`server.closeIdleConnections()`]: http.md#servercloseidleconnections
<add>[`server.headersTimeout`]: http.md#serverheaderstimeout
<add>[`server.keepAliveTimeout`]: http.md#serverkeepalivetimeout
<ide> [`server.listen()`]: net.md#serverlisten
<add>[`server.maxHeadersCount`]: http.md#servermaxheaderscount
<add>[`server.requestTimeout`]: http.md#serverrequesttimeout
<add>[`server.setTimeout()`]: http.md#serversettimeoutmsecs-callback
<add>[`server.timeout`]: http.md#servertimeout
<ide> [`tls.connect()`]: tls.md#tlsconnectoptions-callback
<ide> [`tls.createSecureContext()`]: tls.md#tlscreatesecurecontextoptions
<ide> [`tls.createServer()`]: tls.md#tlscreateserveroptions-secureconnectionlistener | 2 |
Ruby | Ruby | ignore this test for mysql2 | 94cff67bd1125fb98abe8b642ce2dc0ea26bb6dd | <ide><path>activerecord/test/cases/attribute_methods_test.rb
<ide> def test_read_attributes_before_type_cast_on_boolean
<ide> end
<ide> end
<ide>
<del> def test_read_attributes_before_type_cast_on_datetime
<del> developer = Developer.find(:first)
<del> # Oracle adapter returns Time before type cast
<del> unless current_adapter?(:OracleAdapter)
<del> assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"]
<del> else
<del> assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"].to_s(:db)
<add> unless current_adapter?(:Mysql2Adapter)
<add> def test_read_attributes_before_type_cast_on_datetime
<add> developer = Developer.find(:first)
<add> # Oracle adapter returns Time before type cast
<add> unless current_adapter?(:OracleAdapter)
<add> assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"]
<add> else
<add> assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"].to_s(:db)
<ide>
<del> developer.created_at = "345643456"
<del> assert_equal developer.created_at_before_type_cast, "345643456"
<del> assert_equal developer.created_at, nil
<add> developer.created_at = "345643456"
<add> assert_equal developer.created_at_before_type_cast, "345643456"
<add> assert_equal developer.created_at, nil
<ide>
<del> developer.created_at = "2010-03-21T21:23:32+01:00"
<del> assert_equal developer.created_at_before_type_cast, "2010-03-21T21:23:32+01:00"
<del> assert_equal developer.created_at, Time.parse("2010-03-21T21:23:32+01:00")
<add> developer.created_at = "2010-03-21T21:23:32+01:00"
<add> assert_equal developer.created_at_before_type_cast, "2010-03-21T21:23:32+01:00"
<add> assert_equal developer.created_at, Time.parse("2010-03-21T21:23:32+01:00")
<add> end
<ide> end
<ide> end
<ide> | 1 |
Ruby | Ruby | get deprecation methods and callers straight | 29cec6d0ab540263ac25c906c9ccfd5fb3a389cc | <ide><path>activesupport/lib/active_support/deprecation.rb
<ide> def silence
<ide> private
<ide> def deprecation_message(callstack, message = nil)
<ide> file, line, method = extract_callstack(callstack)
<del> message ||= "#{method} is deprecated and will be removed from Rails 2.0."
<del> "DEPRECATION WARNING: #{message}. See http://www.rubyonrails.org/deprecation for details. (#{method} at #{file}:#{line})"
<add> message ||= "You are using deprecated behavior which will be removed from Rails 2.0."
<add> "DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. (called from #{method} at #{file}:#{line})"
<ide> end
<ide>
<ide> def extract_callstack(callstack)
<ide> def deprecate(*method_names)
<ide> method_names.each do |method_name|
<ide> class_eval(<<-EOS, __FILE__, __LINE__)
<ide> def #{method_name}_with_deprecation(*args, &block)
<del> ::ActiveSupport::Deprecation.warn
<add> ::ActiveSupport::Deprecation.warn("#{method_name} is deprecated and will be removed from Rails 2.0", caller)
<ide> #{method_name}_without_deprecation(*args, &block)
<ide> end
<ide> EOS
<ide><path>activesupport/test/deprecation_test.rb
<ide> def test_undeprecated
<ide> end
<ide>
<ide> def test_deprecate_class_method
<del> assert_deprecated(/none is deprecated/) do
<add> assert_deprecated(/none is deprecated.*test_deprecate_class_method at/) do
<ide> assert_equal 1, @dtc.none
<ide> end
<ide> | 2 |
Text | Text | fix small typos [ci skip] | 610de88b1cbd7a9ee462d646c9d8bf1e3ea73fc8 | <ide><path>guides/source/autoloading_and_reloading_constants.md
<ide> On the contrary, if `ApplicationController` is unknown, the constant is
<ide> considered missing and an autoload is going to be attempted by Rails.
<ide>
<ide> In order to load `ApplicationController`, Rails iterates over `autoload_paths`.
<del>First checks if `app/assets/application_controller.rb` exists. If it does not,
<add>First it checks if `app/assets/application_controller.rb` exists. If it does not,
<ide> which is normally the case, it continues and finds
<ide> `app/controllers/application_controller.rb`.
<ide>
<ide> file is loaded. If the file actually defines `Post` all is fine, otherwise
<ide> ### Qualified References
<ide>
<ide> When a qualified constant is missing Rails does not look for it in the parent
<del>namespaces. But there is a caveat: When a constant is missing, Rails is
<add>namespaces. But there is a caveat: when a constant is missing, Rails is
<ide> unable to tell if the trigger was a relative reference or a qualified one.
<ide>
<ide> For example, consider | 1 |
PHP | PHP | support local driver in url method | 414f3da9bb548b4b8f8553bf3645dd5b2d796db0 | <ide><path>src/Illuminate/Filesystem/FilesystemAdapter.php
<ide> use League\Flysystem\FilesystemInterface;
<ide> use League\Flysystem\AwsS3v3\AwsS3Adapter;
<ide> use League\Flysystem\FileNotFoundException;
<add>use League\Flysystem\Adapter\Local as LocalAdapter;
<ide> use Illuminate\Contracts\Filesystem\Filesystem as FilesystemContract;
<ide> use Illuminate\Contracts\Filesystem\Cloud as CloudFilesystemContract;
<ide> use Illuminate\Contracts\Filesystem\FileNotFoundException as ContractFileNotFoundException;
<ide> public function url($path)
<ide> {
<ide> $adapter = $this->driver->getAdapter();
<ide>
<del> if (! $adapter instanceof AwsS3Adapter) {
<add> if ($adapter instanceof AwsS3Adapter) {
<add> return $adapter->getClient()->getObjectUrl($adapter->getBucket(), $path);
<add> } elseif ($adapter instanceof LocalAdapter) {
<add> return '/storage/'.$path;
<add> } else {
<ide> throw new RuntimeException('This driver does not support retrieving URLs.');
<ide> }
<del>
<del> $bucket = $adapter->getBucket();
<del>
<del> return $adapter->getClient()->getObjectUrl($bucket, $path);
<ide> }
<ide>
<ide> /** | 1 |
Python | Python | fix merge conflicts | ababd952100de2d4f5f4a3bbb4925406443b98c4 | <ide><path>keras/activations.py
<ide> def softmax(x):
<ide> if ndim == 2:
<ide> return K.softmax(x)
<ide> elif ndim == 3:
<del> # apply softmax to each timestep
<del> def step(x, states):
<del> return K.softmax(x), []
<del> last_output, outputs, states = K.rnn(step, x,
<del> [],
<del> mask=None)
<del> return outputs
<add> e = K.exp(x - K.max(x, axis=-1, keepdims=True))
<add> s = K.sum(e, axis=-1, keepdims=True)
<add> return e / s
<ide> else:
<ide> raise Exception('Cannot apply softmax to a tensor that is not 2D or 3D. ' +
<ide> 'Here, ndim=' + str(ndim))
<ide><path>keras/backend/tensorflow_backend.py
<ide> def spatial_2d_padding(x, padding=(1, 1), dim_ordering='th'):
<ide> [0, 0]]
<ide> return tf.pad(x, pattern)
<ide>
<add>def pack(x):
<add> return tf.pack(x)
<ide>
<ide> # VALUE MANIPULATION
<ide>
<ide><path>keras/backend/theano_backend.py
<ide> def spatial_3d_padding(x, padding=(1, 1, 1), dim_ordering='th'):
<ide> raise Exception('Invalid dim_ordering: ' + dim_ordering)
<ide> return T.set_subtensor(output[indices], x)
<ide>
<add>def pack(x):
<add> return T.stack(*x)
<ide>
<ide> # VALUE MANIPULATION
<ide>
<ide><path>keras/layers/core.py
<ide> def output_shape(self):
<ide> return (input_shape[0], input_shape[1], self.output_dim)
<ide>
<ide> def get_output(self, train=False):
<del> X = self.get_input(train)
<del>
<del> def step(x, states):
<del> output = K.dot(x, self.W) + self.b
<del> return output, []
<del>
<del> last_output, outputs, states = K.rnn(step, X,
<del> initial_states=[],
<del> mask=None)
<del> outputs = self.activation(outputs)
<del> return outputs
<add> X = self.get_input(train) # (samples, timesteps, input_dim)
<add> # Squash samples and timesteps into a single axis
<add> x = K.reshape(X, (-1, self.input_shape[-1])) # (samples * timesteps, input_dim)
<add> Y = K.dot(x, self.W) + self.b # (samples * timesteps, output_dim)
<add> # We have to reshape Y to (samples, timesteps, output_dim)
<add> input_length = self.input_shape[1]
<add> # Note: input_length will always be provided when using tensorflow backend.
<add> if not input_length:
<add> input_length = K.shape(X)[1]
<add> Y = K.reshape(Y, (-1, input_length, self.output_shape[-1])) # (samples, timesteps, output_dim)
<add> Y = self.activation(Y)
<add> return Y
<ide>
<ide> def get_config(self):
<ide> config = {'name': self.__class__.__name__,
<ide><path>keras/layers/recurrent.py
<ide> def get_constants(self, x, train=False):
<ide>
<ide> def get_initial_states(self, x):
<ide> # build an all-zero tensor of shape (samples, output_dim)
<del> initial_state = K.zeros_like(x) # (samples, timesteps, input_dim)
<del> initial_state = K.sum(initial_state, axis=1) # (samples, input_dim)
<del> reducer = K.zeros((self.input_dim, self.output_dim))
<del> initial_state = K.dot(initial_state, reducer) # (samples, output_dim)
<add> initial_state = x[:, 0, 0] * 0 # (samples, )
<add> initial_state = K.pack([initial_state] * self.output_dim) # (output_dim, samples)
<add> initial_state = K.permute_dimensions(initial_state, (1, 0)) # (samples, output_dim)
<ide> initial_states = [initial_state for _ in range(len(self.states))]
<ide> return initial_states
<ide> | 5 |
Python | Python | add unit tests for pigoperator | ae171f286fc7701661c7b3b3324c39ef24140c24 | <ide><path>tests/providers/apache/pig/operators/__init__.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<ide><path>tests/providers/apache/pig/operators/test_pig.py
<add># Licensed to the Apache Software Foundation (ASF) under one
<add># or more contributor license agreements. See the NOTICE file
<add># distributed with this work for additional information
<add># regarding copyright ownership. The ASF licenses this file
<add># to you under the Apache License, Version 2.0 (the
<add># "License"); you may not use this file except in compliance
<add># with the License. You may obtain a copy of the License at
<add>#
<add># http://www.apache.org/licenses/LICENSE-2.0
<add>#
<add># Unless required by applicable law or agreed to in writing,
<add># software distributed under the License is distributed on an
<add># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
<add># KIND, either express or implied. See the License for the
<add># specific language governing permissions and limitations
<add># under the License.
<add>
<add>import unittest
<add>
<add>import mock
<add>
<add>from airflow.providers.apache.pig.hooks.pig import PigCliHook
<add>from airflow.providers.apache.pig.operators.pig import PigOperator
<add>
<add>TEST_TASK_ID = "test_task_id"
<add>TEST_CONTEXT_ID = "test_context_id"
<add>PIG = "ls /;"
<add>
<add>
<add>class TestPigOperator(unittest.TestCase):
<add> def test_prepare_template(self):
<add> pig = "sh echo $DATE;"
<add> task_id = TEST_TASK_ID
<add>
<add> operator = PigOperator(pig=pig, task_id=task_id)
<add> operator.prepare_template()
<add> self.assertEqual(pig, operator.pig)
<add>
<add> # converts when pigparams_jinja_translate = true
<add> operator = PigOperator(pig=pig, task_id=task_id, pigparams_jinja_translate=True)
<add> operator.prepare_template()
<add> self.assertEqual("sh echo {{ DATE }};", operator.pig)
<add>
<add> @mock.patch.object(PigCliHook, 'run_cli')
<add> def test_execute(self, mock_run_cli):
<add> pig_opts = "-x mapreduce"
<add> operator = PigOperator(pig=PIG, pig_opts=pig_opts, task_id=TEST_TASK_ID)
<add> operator.execute(context=TEST_CONTEXT_ID)
<add>
<add> mock_run_cli.assert_called_once_with(pig=PIG, pig_opts=pig_opts)
<add>
<add> @mock.patch.object(PigCliHook, 'run_cli')
<add> def test_execute_default_pig_opts_to_none(self, mock_run_cli):
<add> operator = PigOperator(pig=PIG, task_id=TEST_TASK_ID)
<add> operator.execute(context=TEST_CONTEXT_ID)
<add>
<add> mock_run_cli.assert_called_once_with(pig=PIG, pig_opts=None)
<add>
<add> @mock.patch.object(PigCliHook, 'run_cli')
<add> @mock.patch.object(PigCliHook, 'kill')
<add> def test_on_kill(self, mock_kill, mock_rul_cli):
<add> operator = PigOperator(pig=PIG, task_id=TEST_TASK_ID)
<add> operator.execute(context=TEST_CONTEXT_ID)
<add> operator.on_kill()
<add>
<add> mock_rul_cli.assert_called()
<add> mock_kill.assert_called()
<ide><path>tests/test_project_structure.py
<ide> 'tests/providers/apache/cassandra/sensors/test_record.py',
<ide> 'tests/providers/apache/cassandra/sensors/test_table.py',
<ide> 'tests/providers/apache/hdfs/sensors/test_web_hdfs.py',
<del> 'tests/providers/apache/pig/operators/test_pig.py',
<ide> 'tests/providers/apache/spark/hooks/test_spark_jdbc_script.py',
<ide> 'tests/providers/google/cloud/operators/test_datastore.py',
<ide> 'tests/providers/google/cloud/transfers/test_sql_to_gcs.py', | 3 |
Text | Text | fix http properties documented as methods | d4378419616ba9eaea1023be8baef938515c160e | <ide><path>doc/api/http.md
<ide> added: v5.7.0
<ide> A Boolean indicating whether or not the server is listening for
<ide> connections.
<ide>
<del>### server.maxHeadersCount([limit])
<add>### server.maxHeadersCount
<ide> <!-- YAML
<ide> added: v0.7.0
<ide> -->
<ide>
<del>* `limit` {number} Defaults to 1000.
<add>* {number} Defaults to 2000.
<ide>
<del>Limits maximum incoming headers count, equal to 1000 by default. If set to 0 -
<add>Limits maximum incoming headers count, equal to 2000 by default. If set to 0 -
<ide> no limit will be applied.
<ide>
<ide> ### server.setTimeout([msecs][, callback])
<ide> to the Server's `'timeout'` event, timeouts must be handled explicitly.
<ide>
<ide> Returns `server`.
<ide>
<del>### server.timeout([msecs])
<add>### server.timeout
<ide> <!-- YAML
<ide> added: v0.9.12
<ide> -->
<ide>
<del>* `msecs` {number} Defaults to 120000 (2 minutes).
<add>* {number} Defaults to 120000 (2 minutes).
<ide>
<ide> The number of milliseconds of inactivity before a socket is presumed
<ide> to have timed out. | 1 |
PHP | PHP | improve code readability | dee76c0f158239ea97afe3ba375c2f1e3aa9d07c | <ide><path>src/Datasource/QueryTrait.php
<ide> public function all(): ResultSetInterface
<ide> return $this->_results;
<ide> }
<ide>
<add> $results = null;
<ide> if ($this->_cache) {
<ide> $results = $this->_cache->fetch($this);
<ide> }
<del> if (!isset($results)) {
<add> if ($results === null) {
<ide> $results = $this->_decorateResults($this->_execute());
<ide> if ($this->_cache) {
<ide> $this->_cache->store($this, $results); | 1 |
Python | Python | redirect the other stream to temp. file | 36c43214d25101c7acd63e0394877b5e04661639 | <ide><path>numpy/distutils/tests/test_exec_command.py
<ide> import os
<ide> import sys
<ide> import StringIO
<add>from tempfile import TemporaryFile
<ide>
<ide> from numpy.distutils import exec_command
<ide>
<ide> def test_exec_command_stdout():
<ide>
<ide> # Test posix version:
<ide> with redirect_stdout(StringIO.StringIO()):
<del> exec_command.exec_command("cd '.'")
<add> with redirect_stderr(TemporaryFile()):
<add> exec_command.exec_command("cd '.'")
<ide>
<ide> # Test non-posix version:
<ide> with emulate_nonposix():
<ide> with redirect_stdout(StringIO.StringIO()):
<del> exec_command.exec_command("cd '.'")
<add> with redirect_stderr(TemporaryFile()):
<add> exec_command.exec_command("cd '.'")
<ide>
<ide> def test_exec_command_stderr():
<ide> # Test posix version:
<del> with redirect_stderr(StringIO.StringIO()):
<del> exec_command.exec_command("cd '.'")
<add> with redirect_stdout(TemporaryFile()):
<add> with redirect_stderr(StringIO.StringIO()):
<add> exec_command.exec_command("cd '.'")
<ide>
<ide> # Test non-posix version:
<ide> with emulate_nonposix():
<del> with redirect_stderr(StringIO.StringIO()):
<del> exec_command.exec_command("cd '.'")
<add> with redirect_stdout(TemporaryFile()):
<add> with redirect_stderr(StringIO.StringIO()):
<add> exec_command.exec_command("cd '.'") | 1 |
Javascript | Javascript | fix recursive rm test to actually use tmpdir | a566c05a4996ddf78f2d4993247ec12f57f1f5f6 | <ide><path>test/parallel/test-fs-rmdir-recursive.js
<ide> const assert = require('assert');
<ide> const fs = require('fs');
<ide> const path = require('path');
<ide> const { validateRmdirOptions } = require('internal/fs/utils');
<del>let count = 0;
<ide>
<ide> tmpdir.refresh();
<ide>
<add>let count = 0;
<add>const nextDirPath = (name = 'rmdir-recursive') =>
<add> path.join(tmpdir.path, `${name}-${count++}`);
<add>
<ide> function makeNonEmptyDirectory(depth, files, folders, dirname, createSymLinks) {
<ide> fs.mkdirSync(dirname, { recursive: true });
<ide> fs.writeFileSync(path.join(dirname, 'text.txt'), 'hello', 'utf8');
<ide> function removeAsync(dir) {
<ide> // Test the asynchronous version
<ide> {
<ide> // Create a 4-level folder hierarchy including symlinks
<del> let dir = `rmdir-recursive-${count}`;
<add> let dir = nextDirPath();
<ide> makeNonEmptyDirectory(4, 10, 2, dir, true);
<ide> removeAsync(dir);
<ide>
<ide> // Create a 2-level folder hierarchy without symlinks
<del> count++;
<del> dir = `rmdir-recursive-${count}`;
<add> dir = nextDirPath();
<ide> makeNonEmptyDirectory(2, 10, 2, dir, false);
<ide> removeAsync(dir);
<ide>
<ide> // Create a flat folder including symlinks
<del> count++;
<del> dir = `rmdir-recursive-${count}`;
<add> dir = nextDirPath();
<ide> makeNonEmptyDirectory(1, 10, 2, dir, true);
<ide> removeAsync(dir);
<ide> }
<ide>
<ide> // Test the synchronous version.
<ide> {
<del> count++;
<del> const dir = `rmdir-recursive-${count}`;
<add> const dir = nextDirPath();
<ide> makeNonEmptyDirectory(4, 10, 2, dir, true);
<ide>
<ide> // Removal should fail without the recursive option set to true.
<ide> function removeAsync(dir) {
<ide>
<ide> // Test the Promises based version.
<ide> (async () => {
<del> count++;
<del> const dir = `rmdir-recursive-${count}`;
<add> const dir = nextDirPath();
<ide> makeNonEmptyDirectory(4, 10, 2, dir, true);
<ide>
<ide> // Removal should fail without the recursive option set to true. | 1 |
Javascript | Javascript | fix multiple expectedwarnings bug | 682b85036efcaa87c580483f68ba71fbb13af4b9 | <ide><path>test/common/index.js
<ide> function expectWarning(name, expected) {
<ide> // Remove a warning message after it is seen so that we guarantee that we
<ide> // get each message only once.
<ide> map.delete(expected);
<del> }, map.size);
<add> }, expected.length);
<ide> }
<ide>
<ide> function expectWarningByName(name, expected, code) { | 1 |
Python | Python | apply suggestions from code review | c381719745b6c7c29817a569ce0d431e2cd72ff5 | <ide><path>numpy/core/tests/test_nditer.py
<ide> def test_0d_iter():
<ide> assert_equal(i.ndim, 0)
<ide> assert_equal(len(i), 1)
<ide>
<del> i = nditer(np.arange(5), ['multi_index'], [['readonly']], op_axes=[()], itershape=())
<add> i = nditer(np.arange(5), ['multi_index'], [['readonly']],
<add> op_axes=[()], itershape=())
<ide> assert_equal(i.ndim, 0)
<ide> assert_equal(len(i), 1)
<ide>
<ide> # passing an itershape alone is not enough, the op_axes are also needed
<del> assert_raises(ValueError, nditer, np.arange(5), ['multi_index'], [['readonly']], itershape=())
<add> with assert_raises(ValueError):
<add> nditer(np.arange(5), ['multi_index'], [['readonly']], itershape=())
<ide>
<ide> # Test a more complex buffered casting case (same as another test above)
<ide> sdt = [('a', 'f4'), ('b', 'i8'), ('c', 'c8', (2, 3)), ('d', 'O')] | 1 |
Javascript | Javascript | add test suite for accumulate function | d61da93878159d300f8b199cf01d240dd4bf429a | <ide><path>packages/events/__tests__/accumulate-test.internal.js
<add>/**
<add> * Copyright (c) Facebook, Inc. and its affiliates.
<add> *
<add> * This source code is licensed under the MIT license found in the
<add> * LICENSE file in the root directory of this source tree.
<add> *
<add> * @emails react-core
<add> */
<add>
<add>'use strict';
<add>
<add>let accumulate;
<add>
<add>describe('accumulate', () => {
<add> beforeEach(() => {
<add> accumulate = require('events/accumulate').default;
<add> });
<add>
<add> it('throws if the second item is null', () => {
<add> expect(function() {
<add> accumulate([], null);
<add> }).toThrowError(
<add> 'accumulate(...): Accumulated items must not be null or undefined.',
<add> );
<add> });
<add>
<add> it('return second item if first item is null', () => {
<add> const a = [];
<add> expect(accumulate(null, a)).toBe(a);
<add> });
<add>
<add> it('return concatenation of items if first item is an array', () => {
<add> const a = ['hello'];
<add> const b = 'world';
<add> expect(accumulate(a, b)).toEqual(['hello', 'world']);
<add> });
<add>
<add> it('return concatenation of items if second item is an array', () => {
<add> const a = 'hello';
<add> const b = ['world'];
<add> expect(accumulate(a, b)).toEqual(['hello', 'world']);
<add> });
<add>
<add> it('return an array containing both items if neither item is an array', () => {
<add> const a = 'hello';
<add> const b = 'world';
<add> expect(accumulate(a, b)).toEqual(['hello', 'world']);
<add> });
<add>});
<ide><path>packages/events/accumulate.js
<ide> function accumulate<T>(
<ide> ): T | Array<T> {
<ide> invariant(
<ide> next != null,
<del> 'accumulate(...): Accumulated items must be not be null or undefined.',
<add> 'accumulate(...): Accumulated items must not be null or undefined.',
<ide> );
<ide>
<ide> if (current == null) { | 2 |
Ruby | Ruby | add railties test of custom handlers and formats | a70ad604cfbbf191bc27e784c3fe1913a8c7b238 | <ide><path>railties/test/application/rendering_test.rb
<ide> def show
<ide> get "/pages/foo.bar"
<ide> assert_equal 200, last_response.status
<ide> end
<add>
<add> test "New formats and handlers are detected from initializers" do
<add> app_file "config/routes.rb", <<-RUBY
<add> Rails.application.routes.draw do
<add> root to: 'pages#show'
<add> end
<add> RUBY
<add>
<add> app_file "app/controllers/pages_controller.rb", <<-RUBY
<add> class PagesController < ApplicationController
<add> layout false
<add>
<add> def show
<add> render :show, formats: [:awesome], handlers: [:rubby]
<add> end
<add> end
<add> RUBY
<add>
<add> app_file "app/views/pages/show.awesome.rubby", <<-RUBY
<add> {
<add> format: @current_template.format,
<add> handler: @current_template.handler
<add> }.inspect
<add> RUBY
<add>
<add> app_file "config/initializers/mime_types.rb", <<-RUBY
<add> Mime::Type.register "text/awesome", :awesome
<add> RUBY
<add>
<add> app_file "config/initializers/template_handlers.rb", <<-RUBY
<add> module RubbyHandler
<add> def self.call(_, source)
<add> source
<add> end
<add> end
<add> ActionView::Template.register_template_handler(:rubby, RubbyHandler)
<add> RUBY
<add>
<add> get "/"
<add> assert_equal 200, last_response.status
<add> assert_equal "{:format=>:awesome, :handler=>RubbyHandler}", last_response.body
<add> end
<ide> end
<ide> end | 1 |
Python | Python | use distribution utils in xlnet | 55d41fd67d7c08e9a88cc38f41f2b32089bde134 | <ide><path>official/nlp/xlnet/run_classifier.py
<ide> # ==============================================================================
<ide> """XLNet classification finetuning runner in tf2.0."""
<ide>
<del>from __future__ import absolute_import
<del>from __future__ import division
<del># from __future__ import google_type_annotations
<del>from __future__ import print_function
<del>
<ide> import functools
<ide> # Import libraries
<ide> from absl import app
<ide> from official.nlp.xlnet import training_utils
<ide> from official.nlp.xlnet import xlnet_config
<ide> from official.nlp.xlnet import xlnet_modeling as modeling
<del>from official.utils.misc import tpu_lib
<add>from official.utils.misc import distribution_utils
<ide>
<ide> flags.DEFINE_integer("n_class", default=2, help="Number of classes.")
<ide> flags.DEFINE_string(
<ide> def get_metric_fn():
<ide>
<ide> def main(unused_argv):
<ide> del unused_argv
<del> if FLAGS.strategy_type == "mirror":
<del> strategy = tf.distribute.MirroredStrategy()
<del> elif FLAGS.strategy_type == "tpu":
<del> cluster_resolver = tpu_lib.tpu_initialize(FLAGS.tpu)
<del> strategy = tf.distribute.experimental.TPUStrategy(cluster_resolver)
<del> else:
<del> raise ValueError("The distribution strategy type is not supported: %s" %
<del> FLAGS.strategy_type)
<add> strategy = distribution_utils.get_distribution_strategy(
<add> distribution_strategy=FLAGS.strategy_type,
<add> tpu_address=FLAGS.tpu)
<ide> if strategy:
<ide> logging.info("***** Number of cores used : %d",
<ide> strategy.num_replicas_in_sync)
<ide><path>official/nlp/xlnet/run_pretrain.py
<ide> # See the License for the specific language governing permissions and
<ide> # limitations under the License.
<ide> # ==============================================================================
<del>"""XLNet classification finetuning runner in tf2.0."""
<del>
<del>from __future__ import absolute_import
<del>from __future__ import division
<del># from __future__ import google_type_annotations
<del>from __future__ import print_function
<add>"""XLNet pretraining runner in tf2.0."""
<ide>
<ide> import functools
<ide> import os
<ide> from official.nlp.xlnet import training_utils
<ide> from official.nlp.xlnet import xlnet_config
<ide> from official.nlp.xlnet import xlnet_modeling as modeling
<del>from official.utils.misc import tpu_lib
<add>from official.utils.misc import distribution_utils
<ide>
<ide> flags.DEFINE_integer(
<ide> "num_predict",
<ide> def get_pretrainxlnet_model(model_config, run_config):
<ide> def main(unused_argv):
<ide> del unused_argv
<ide> num_hosts = 1
<del> if FLAGS.strategy_type == "mirror":
<del> strategy = tf.distribute.MirroredStrategy()
<del> elif FLAGS.strategy_type == "tpu":
<del> cluster_resolver = tpu_lib.tpu_initialize(FLAGS.tpu)
<del> strategy = tf.distribute.experimental.TPUStrategy(cluster_resolver)
<del> topology = FLAGS.tpu_topology.split("x")
<del> total_num_core = 2 * int(topology[0]) * int(topology[1])
<del> num_hosts = total_num_core // FLAGS.num_core_per_host
<del> else:
<del> raise ValueError("The distribution strategy type is not supported: %s" %
<del> FLAGS.strategy_type)
<add> strategy = distribution_utils.get_distribution_strategy(
<add> distribution_strategy=FLAGS.strategy_type,
<add> tpu_address=FLAGS.tpu)
<add> if FLAGS.strategy_type == "tpu":
<add> num_hosts = strategy.extended.num_hosts
<ide> if strategy:
<ide> logging.info("***** Number of cores used : %d",
<ide> strategy.num_replicas_in_sync)
<ide><path>official/nlp/xlnet/run_squad.py
<ide> # ==============================================================================
<ide> """XLNet SQUAD finetuning runner in tf2.0."""
<ide>
<del>from __future__ import absolute_import
<del>from __future__ import division
<del># from __future__ import google_type_annotations
<del>from __future__ import print_function
<del>
<ide> import functools
<ide> import json
<ide> import os
<ide> from official.nlp.xlnet import training_utils
<ide> from official.nlp.xlnet import xlnet_config
<ide> from official.nlp.xlnet import xlnet_modeling as modeling
<del>from official.utils.misc import tpu_lib
<add>from official.utils.misc import distribution_utils
<ide>
<ide> flags.DEFINE_string(
<ide> "test_feature_path", default=None, help="Path to feature of test set.")
<ide> def get_qaxlnet_model(model_config, run_config, start_n_top, end_n_top):
<ide>
<ide> def main(unused_argv):
<ide> del unused_argv
<del> if FLAGS.strategy_type == "mirror":
<del> strategy = tf.distribute.MirroredStrategy()
<del> elif FLAGS.strategy_type == "tpu":
<del> cluster_resolver = tpu_lib.tpu_initialize(FLAGS.tpu)
<del> strategy = tf.distribute.experimental.TPUStrategy(cluster_resolver)
<del> else:
<del> raise ValueError("The distribution strategy type is not supported: %s" %
<del> FLAGS.strategy_type)
<add> strategy = distribution_utils.get_distribution_strategy(
<add> distribution_strategy=FLAGS.strategy_type,
<add> tpu_address=FLAGS.tpu)
<ide> if strategy:
<ide> logging.info("***** Number of cores used : %d",
<ide> strategy.num_replicas_in_sync) | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.