tree: 685b357252f5f7671b60b0776ceed67b40160744 [path history] [tgz]
  1. add_class.incremental.yaml
  2. add_compound_instance_field.incremental.yaml
  3. add_export.incremental.yaml
  4. add_field_and_remove_subclass.incremental.yaml
  5. add_import.incremental.yaml
  6. add_instance_field.incremental.yaml
  7. add_instance_method.incremental.yaml
  8. add_named_mixin_application.incremental.yaml
  9. add_part.incremental.yaml
  10. add_static_field.incremental.yaml
  11. add_static_method.incremental.yaml
  12. add_top_level_const_field.incremental.yaml
  13. add_top_level_field.incremental.yaml
  14. add_top_level_method.incremental.yaml
  15. add_unused_enum_class.incremental.yaml
  16. bad_diagnostics.incremental.yaml
  17. bad_stack_trace_repro.incremental.yaml
  18. call_instance_tear_off_named.incremental.yaml
  19. call_named_arguments_1.incremental.yaml
  20. call_named_arguments_2.incremental.yaml
  21. call_named_arguments_from_instance_method.incremental.yaml
  22. change_in_part.incremental.yaml
  23. change_library_name.incremental.yaml
  24. change_optional_arguments.incremental.yaml
  25. change_supertype.incremental.yaml
  26. closure.incremental.yaml
  27. closure_capture.incremental.yaml
  28. compile_time_error_001.incremental.yaml
  29. compile_time_error_002.incremental.yaml
  30. compile_time_error_003.incremental.yaml
  31. compile_time_error_004.incremental.yaml
  32. compile_time_error_005.incremental.yaml
  33. compile_time_error_006.incremental.yaml
  34. compile_time_error_field_becomes_removed_function.incremental.yaml
  35. compile_time_error_hides_field.incremental.yaml
  36. compile_time_error_partial_file.incremental.yaml
  37. compound_constants.incremental.yaml
  38. constant_retaining.incremental.yaml
  39. constant_retaining_2.incremental.yaml
  40. constant_retaining_3.incremental.yaml
  41. constants.incremental.yaml
  42. constants_of_new_classes.incremental.yaml
  43. fix_compile_time_error_in_field.incremental.yaml
  44. generic_types_001.incremental.yaml
  45. generic_types_002.incremental.yaml
  46. generic_types_003.incremental.yaml
  47. generic_types_004.incremental.yaml
  48. hello_world.incremental.yaml
  49. instance_field_end.incremental.yaml
  50. instance_field_middle.incremental.yaml
  51. instance_field_to_static_field.incremental.yaml
  52. interceptor_classes.incremental.yaml
  53. invalidate_method_used_in_tearoff.incremental.yaml
  54. invalidate_method_with_optional_parameters.incremental.yaml
  55. lazy_static.incremental.yaml
  56. local_function_closure.incremental.yaml
  57. main_args.incremental.yaml
  58. main_signature_change.incremental.yaml
  59. modify_instance_method.incremental.yaml
  60. modify_static_method.incremental.yaml
  61. multiple_libraries.incremental.yaml
  62. new_instance_tearoff.incremental.yaml
  63. newly_instantiated_class.incremental.yaml
  64. newly_instantiated_class_with_fields.incremental.yaml
  65. newly_instantiated_class_X.incremental.yaml
  66. newly_instantiated_subclases_two_updates.incremental.yaml
  67. newly_instantiated_superclasses_two_updates.incremental.yaml
  68. no_closure.incremental.yaml
  69. override_field_with_method_conflict.incremental.yaml
  70. override_getter_with_method_conflict.incremental.yaml
  71. override_method_with_field_conflict.incremental.yaml
  72. override_method_with_getter_conflict.incremental.yaml
  73. preserving_identity_hashcode.incremental.yaml
  74. README.md
  75. remove_class.incremental.yaml
  76. remove_class_with_field_and_subclass.incremental.yaml
  77. remove_class_with_static_method.incremental.yaml
  78. remove_compound_instance_field.incremental.yaml
  79. remove_instance_field.incremental.yaml
  80. remove_instance_method.incremental.yaml
  81. remove_instance_method_stored_in_tearoff.incremental.yaml
  82. remove_instance_method_super_access.incremental.yaml
  83. remove_instance_method_with_optional_parameters.incremental.yaml
  84. remove_instance_method_with_optional_parameters_stored_in_tearoff.incremental.yaml
  85. remove_named_mixin_application.incremental.yaml
  86. remove_static_method.incremental.yaml
  87. remove_top_level_method.incremental.yaml
  88. remove_unused_enum_class.incremental.yaml
  89. same_tokens.incremental.yaml
  90. same_tokens_variant.incremental.yaml
  91. signature_change_instance_method.incremental.yaml
  92. signature_change_parameter_instance_method.incremental.yaml
  93. signature_change_static_method.incremental.yaml
  94. signature_change_top_level_method.incremental.yaml
  95. source_maps_no_throw.incremental.yaml
  96. static_field_to_instance_field.incremental.yaml
  97. stored_closure.incremental.yaml
  98. stored_instance_tearoff.incremental.yaml
  99. stored_instance_tearoff_with_named_parameters.incremental.yaml
  100. stored_instance_tearoff_with_optional_positional_parameters.incremental.yaml
  101. subclass_schema_1.incremental.yaml
  102. subclass_schema_2.incremental.yaml
  103. subclass_schema_3.incremental.yaml
  104. super_call_signature_change.incremental.yaml
  105. super_call_simple_change.incremental.yaml
  106. super_classes_of_directly_instantiated.incremental.yaml
  107. super_is_parameter.incremental.yaml
  108. super_schema.incremental.yaml
  109. two_updates.incremental.yaml
  110. two_updates_instance_method.incremental.yaml
  111. two_updates_not_main.incremental.yaml
  112. two_updates_with_removal.incremental.yaml
  113. unchanged_named_mixin_application.incremental.yaml
  114. update_dependencies.incremental.yaml
  115. update_dependencies_recoverable_compile_time_error.incremental.yaml
  116. update_dependencies_unrecoverable_compile_time_error.incremental.yaml
pkg/front_end/testcases/dartino/README.md

List of tests on this form:

```
TEST_NAME
==> a_test_file.dart <==
... source code for a_test_file.dart ...
==> another_test_file.dart.patch <==
... source code for another_test_file.dart ...
```

Filenames ending with “.patch” are special and are expanded into multiple versions of a file. The parts of the file that vary between versions are surrounded by <<<< and >>>> and the alternatives are separated by ====. For example:

```
==> file.txt.patch <==
first
<<<< "ex1"
v1
==== "ex2"
v2
==== "ex2"
v3
>>>>
last
```

Will produce three versions of a file named file.txt.patch:

Version 1: first v1 last With expectation ex1

Version 2: first v2 last

With expectation ex2

Version 3: first v3 last

With expectation ex3

It is possible to have several independent changes in the same patch. However, most of the time, it's problematic to have more than one change in a patch. See topic below on “Making minimal changes”. One should only specify the expectations once. For example:

==> main.dart.patch <==
class Foo {
<<<< "a"
==== "b"
  var bar;
>>>>
}
main() {
  var foo = new Foo();
<<<<
  print("a");
====
  print("b");
>>>>
}

Expectations

An expectation is a JSON string. It is decoded and the resulting object, o, is converted to a [ProgramExpectation] in the following way:

  • If o is a [String]: new ProgramExpectation([o]), otherwise

  • if o is a [List]: new ProgramExpectation(o), otherwise

  • a new [ProgramExpectation] instance is instantiated with its fields initialized to the corresponding properties of the JSON object. See [ProgramExpectation.fromJson].

Make minimal changes

When adding new tests, it's important to keep the changes to the necessary minimum. We do this to ensure that a test actually tests what we intend, and to avoid accidentally relying on side-effects of other changes making the test pass or fail unexpectedly.

Let's look at an example of testing what happens when an instance field is added.

A good test:

==> main.dart.patch <==
class Foo {
<<<< ["instance is null", "setter threw", "getter threw"]
==== "v2"
  var bar;
>>>>
}
var instance;
main() {
  if (instance == null) {
    print("instance is null");
    instance = new Foo();
  }
  try {
    instance.bar = "v2";
  } catch (e) {
    print("setter threw");
  }
  try {
    print(instance.bar);
  } catch (e) {
    print("getter threw");
  }
}

A problematic version of the same test:

==> main.dart.patch <==
class Foo {
<<<< "v1"
==== "v2"
  var bar;
>>>>
}
var instance;
main() {
<<<<
  instance = new Foo();
  print("v1");
====
  instance.bar = 42;
  print(instance.bar);
>>>>
}

The former version tests precisely what happens when an instance field is added to a class, we assume this is the intent of the test.

The latter version tests what happens when:

  • An instance field is added to a class.

  • A modification is made to a top-level method.

  • A modifiction is made to the main method, which is a special case.

  • Two more selectors are added to tree-shaking, the enqueuer: ‘get:bar’, and ‘set:bar’.

The latter version does not test:

  • If an instance field is added, does existing accessors correctly access the new field. As main was explicitly changed, we don't know if already compiled accessors behave correctly.