Commits

masklinn committed 87e9773

Add support for informally deprecated <> operator, fixes #9

Comments (0)

Files changed (2)

     var PY_operators = {
         '==': ['eq', 'eq', function (a, b) { return a === b; }],
         '!=': ['ne', 'ne', function (a, b) { return a !== b; }],
+        '<>': ['ne', 'ne', function (a, b) { return a !== b; }],
         '<': ['lt', 'gt', function (a, b) {return a.constructor.name < b.constructor.name;}],
         '<=': ['le', 'ge', function (a, b) {return a.constructor.name <= b.constructor.name;}],
         '>': ['gt', 'lt', function (a, b) {return a.constructor.name > b.constructor.name;}],
             return b.__contains__(a);
         case 'not in':
             return b.__contains__(a) === py.True ? py.False : py.True;
-        case '==': case '!=':
+        case '==': case '!=': case '<>':
         case '<': case '<=':
         case '>': case '>=':
             return PY_op(a, b, operator);
             expect(py.eval('foo != bar', {foo: 'qux', bar: 'quux'}))
                 .to.be(true);
         });
+        it('should accept deprecated form', function () {
+            expect(py.eval('1 <> 2')).to.be(true);
+            expect(py.eval('"foo" <> "foo"')).to.be(false);
+            expect(py.eval('"foo" <> "bar"')).to.be(true);
+        });
     });
     describe('rich comparisons', function () {
         it('should work with numbers', function () {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.