@@ -41,6 +41,8 @@ ruleTester.run("no-self-assign", rule, {
4141{ code :"({a} = {a: b})" , parserOptions :{ ecmaVersion :6 } } ,
4242{ code :"({a} = {a() {}})" , parserOptions :{ ecmaVersion :6 } } ,
4343{ code :"({a} = {[a]: a})" , parserOptions :{ ecmaVersion :6 } } ,
44+ { code :"({[a]: b} = {[a]: b})" , parserOptions :{ ecmaVersion :6 } } ,
45+ { code :"({'foo': a, 1: a} = {'bar': a, 2: a})" , parserOptions :{ ecmaVersion :6 } } ,
4446{ code :"({a, ...b} = {a, ...b})" , parserOptions :{ ecmaVersion :2018 } } ,
4547{ code :"a.b = a.c" , options :[ { props :true } ] } ,
4648{ code :"a.b = c.b" , options :[ { props :true } ] } ,
@@ -80,6 +82,15 @@ ruleTester.run("no-self-assign", rule, {
8082{ code :"[[a], {b}] = [[a], {b}]" , parserOptions :{ ecmaVersion :6 } , errors :[ "'a' is assigned to itself." , "'b' is assigned to itself." ] } ,
8183{ code :"({a} = {a})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'a' is assigned to itself." ] } ,
8284{ code :"({a: b} = {a: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
85+ { code :"({'a': b} = {'a': b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
86+ { code :"({a: b} = {'a': b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
87+ { code :"({'a': b} = {a: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
88+ { code :"({1: b} = {1: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
89+ { code :"({1: b} = {'1': b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
90+ { code :"({'1': b} = {1: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
91+ { code :"({['a']: b} = {a: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
92+ { code :"({'a': b} = {[`a`]: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
93+ { code :"({1: b} = {[1]: b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." ] } ,
8394{ code :"({a, b} = {a, b})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'a' is assigned to itself." , "'b' is assigned to itself." ] } ,
8495{ code :"({a, b} = {b, a})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'b' is assigned to itself." , "'a' is assigned to itself." ] } ,
8596{ code :"({a, b} = {c, a})" , parserOptions :{ ecmaVersion :6 } , errors :[ "'a' is assigned to itself." ] } ,