import sublime
from unittest import TestCase
import time


class TestAsync(TestCase):

    def setUp(self):
        self.view = sublime.active_window().new_file()
        # make sure we have a window to work with
        s = sublime.load_settings("Preferences.sublime-settings")
        s.set("close_windows_when_empty", False)

    def tearDown(self):
        if self.view:
            self.view.set_scratch(True)
            self.view.window().focus_view(self.view)
            self.view.window().run_command("close_file")

    def setText(self, string):
        self.view.run_command("insert", {"characters": string})

    def getRow(self, row):
        return self.view.substr(self.view.line(self.view.text_point(row, 0)))

    def test_defer(self):
        sublime.set_timeout_async(lambda: self.setText("foo"), 10)
        self.view.sel().clear()
        self.view.sel().add(sublime.Region(0, 0))
        sublime.set_timeout_async(lambda: self.setText("foo"), 10)
        time.sleep(0.5)
        self.assertEqual(self.getRow(0), "foofoo")

@@ -738,13 +738,13 @@
 est_
-defer
+async
 (sel

fix typo