testrunner_test.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Copyright 2017 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. goog.setTestOnly();
  15. goog.require('goog.testing.TestCase');
  16. goog.require('goog.testing.TestRunner');
  17. goog.require('goog.testing.asserts');
  18. goog.require('goog.testing.jsunit');
  19. let testRunner;
  20. let testCase;
  21. function setUp() {
  22. testRunner = new goog.testing.TestRunner();
  23. testCase = new goog.testing.TestCase();
  24. }
  25. function testInitialize() {
  26. assert(!testRunner.isInitialized());
  27. testRunner.initialize(testCase);
  28. assert(testRunner.isInitialized());
  29. }
  30. function testIsFinished() {
  31. testRunner.initialize(testCase);
  32. assert(!testRunner.isFinished());
  33. testRunner.logError('oops');
  34. assert(testRunner.isFinished());
  35. }
  36. function testGetUniqueId() {
  37. // We only really care that this string is unique to instances.
  38. const anotherRunner = new goog.testing.TestRunner();
  39. assert(anotherRunner.getUniqueId() != testRunner.getUniqueId());
  40. }