matheusportela / enigma-machine

Enigma machine simulator in JavaScript for didactic purposes.
MIT License
37 stars 10 forks source link

Object.assign ES5 incompatibility #5

Closed rafael-telles closed 8 years ago

rafael-telles commented 8 years ago

I saw you are using Object.assign on test_enigma.js, just be aware that this is a ES2015 feature and may not be compatible in some browsers or NodeJS versions.

More info: https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Object/assign#Browser_compatibility

rafael-telles commented 8 years ago

I noticed it by running your tests, I received these errors (because of my NodeJS version)

  1) Rotor Models Rotor I expect wiring table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertWiringTable (test_enigma.js:234:39)
      at Context.<anonymous> (test_enigma.js:257:13)

  2) Rotor Models Rotor II expect wiring table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertWiringTable (test_enigma.js:234:39)
      at Context.<anonymous> (test_enigma.js:267:13)

  3) Rotor Models Rotor III expect wiring table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertWiringTable (test_enigma.js:234:39)
      at Context.<anonymous> (test_enigma.js:277:13)

  4) Rotor Models Rotor IV expect wiring table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertWiringTable (test_enigma.js:234:39)
      at Context.<anonymous> (test_enigma.js:287:13)

  5) Rotor Models Rotor V expect wiring table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertWiringTable (test_enigma.js:234:39)
      at Context.<anonymous> (test_enigma.js:297:13)

  6) Reflector Models Reflector B expect reflection table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertReflectionTable (test_enigma.js:350:47)
      at Context.<anonymous> (test_enigma.js:365:13)

  7) Reflector Models Reflector C expect reflection table be correctly defined:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at assertReflectionTable (test_enigma.js:350:47)
      at Context.<anonymous> (test_enigma.js:372:13)

  8) Machine encode expect double stepping anomaly exists:
     TypeError: Object function Object() { [native code] } has no method 'assign'
      at Context.<anonymous> (test_enigma.js:468:44)
matheusportela commented 8 years ago

56378b42e2963060e1076becdd9a0301c1a23486 addresses this issue. Could you please test it for me?

rafael-telles commented 8 years ago

Surge I can! I will test it as soon I get my hands on a computer

rafael-telles commented 8 years ago

It worked!

matheusportela commented 8 years ago

Great, thanks!