Commit Graph

724 Commits

Author SHA1 Message Date
gilch
0f81369deb tests for #_ and (comment ...) 2017-08-04 14:35:11 -06:00
Kodi Arfer
67a4815024 Shadow get (#1344) 2017-07-26 21:10:54 -05:00
Kodi Arfer
28ce83524b Don't try to lex tag-macro calls as shebangs 2017-07-23 11:43:19 -07:00
Kodi Arfer
0bbb5f8e34 hy-repr: Support #* and #** 2017-07-19 10:25:24 -07:00
Kodi Arfer
97ecb0b553 Remove apply from tests 2017-07-17 13:34:42 -07:00
Kodi Arfer
2d863abc85 Implement #* and #** unpacking 2017-07-17 13:34:39 -07:00
Kodi Arfer
801836f6c2 Remove the Python 2 yield-from macro
I moved the yield-from tests from native_macros to py3_only_tests.
2017-07-13 08:46:41 -07:00
gilch
7d8ffc0181 Merge pull request #1322 from kirbyfan64/new-rply
Update rply to 0.7.5
2017-07-12 17:51:44 -06:00
Kodi Arfer
33052f4180 Test compiling a lot of comment lines 2017-07-12 14:07:42 -07:00
Kodi Arfer
b7657e8fa3 Require HySymbols instead of HyStrings more often 2017-07-12 10:57:35 -07:00
Kodi Arfer
5a1e6a7c6a hy-repr: Support NaN and Inf 2017-07-10 08:50:49 -07:00
Kodi Arfer
bb91b57dca Require capitalizing NaN and Inf like so 2017-07-10 08:50:49 -07:00
Kodi Arfer
a746ccb42c Refactor test_lex_expression_complex 2017-07-10 08:50:45 -07:00
Kodi Arfer
55986b2033 Auto-promote values to HyObjects in the compiler 2017-07-03 17:01:12 -07:00
Kodi Arfer
4be37b358b Make lists no longer magical for the compiler 2017-07-03 17:01:12 -07:00
Kodi Arfer
ca95194240 Change eval from a special form to a function 2017-06-27 08:14:29 -06:00
Kodi Arfer
f2278cf2f0 Support PYTHONDONTWRITEBYTECODE 2017-06-26 19:00:08 -06:00
Kodi Arfer
399e7628b4 Parametrize test_bin_hy_byte_compile 2017-06-26 18:58:51 -06:00
gilch
672c8a1637 Merge pull request #1307 from hylang/windows-tests
Use universal newlines in test_bin.py
2017-06-26 14:27:16 -06:00
Kodi Arfer
26d1b3f72e Don't parse 5.attr or :foo.attr as symbols 2017-06-23 08:30:37 -07:00
Kodi Arfer
c8736ebd0c Use pytest.raises in test_lex 2017-06-23 08:29:55 -07:00
gilch
b7a0c2abf0 add tag macro tests 2017-06-22 22:49:00 -06:00
gilch
6cd3201421 rename sharp macros to tag macros 2017-06-22 22:48:46 -06:00
gilch
aa08149712 Use universal newlines in test_bin.py
Change run_cmd() implementation in test_bin.py to use universal newlines (text mode) for Windows compatibility.
2017-06-18 16:05:44 -06:00
neil-lindquist
d3df17d9d8 Modify cond to support single argument branches 2017-06-10 08:30:53 -07:00
Kodi Arfer
5bf9ecfc5a Forbid (try) and (try BODY) 2017-05-25 20:48:09 -05:00
Kodi Arfer
dffa2811e6 Return from the else clause of a try form
I overhauled the documentation of `try` while I was editing it.
2017-05-25 20:48:09 -05:00
Kodi Arfer
81d89c9d12 Enforce the standard order of try elements 2017-05-25 20:48:09 -05:00
Kodi Arfer
2eb81864df Make all files comply with license-header policy 2017-04-27 14:16:57 -07:00
Kodi Arfer
eeb0be8fb0 Add some xfail tests for known bugs 2017-04-26 14:00:39 -07:00
Kodi Arfer
d3fa375052 Migrate from Nose to pytest 2017-04-26 14:00:11 -07:00
Kodi Arfer
d085fba5fe Move a quoting test to get rid of a directory 2017-04-26 13:58:09 -07:00
Kodi Arfer
8afd13cb16 Use test functions instead of unittest.TestCase 2017-04-26 13:58:09 -07:00
Kodi Arfer
55c205f87e Test take and drop only in native_tests.core 2017-04-26 13:58:09 -07:00
Kodi Arfer
07e9284100 Correct import syntax in a test 2017-04-25 09:30:13 -07:00
Kodi Arfer
a27d737e1c Drop support for Pythons 3 older than 3.3 2017-04-24 14:22:13 -07:00
Kodi Arfer
4c38e2c9dd Rename reader macros to "sharp macros" (#1282)
They're not actually reader macros, since their arguments are parsed s-expressions, like a regular macro, not pre-parsed source text.
2017-04-21 10:07:48 -05:00
Kodi Arfer
ad94343e4a Merge pull request #1269 from Kodiologist/bytecode
Automatically read and write bytecode
2017-04-14 13:52:07 -07:00
Kodi Arfer
2b11b9be20 Automatically read and write bytecode
Importing or executing a Hy file now loads the byte-compiled version if it exists and is up to date, and if not, the source is byte-compiled after it's parsed.

This change can speed up Hy a lot. Here are some examples comparing run times of the current master (491b474e) to this commit, on my laptop with Python 3.6:

- `nosetests --exclude='test_bin'` goes from 3.8 s to 0.7 s (a 5-fold speedup)
- `hy -c '(print "hello world")` goes from 0.47 s to 0.20 s (a 2-fold speedup)
- Rogue TV's startup goes from 3.6 s to 0.4 s (a 9-fold speedup)

Accompanying changes include:

- `setup.py` now creates and installs bytecode for `hy.core`, `hy.contrib`, and `hy.extra`.
- The `hyc` command under Python 3 now creates bytecode in `__pycache__`, as usual for Python 3, instead of putting the `.pyc` right next to the source file like Python 2 does.

I've removed a test of `hy.extra.anaphoric.a-if` that triggers #1268 when the test file is byte-compiled and then hits some weird `macroexpand` bug or something when I try to work around that—Nose crashes when trying to produce an error message, and I can't seem to replicate the bug without Nose.
2017-04-14 13:38:33 -07:00
Kodi Arfer
5eb928356a Overhaul semantics of binary operators (#1261)
I've added shadow versions of many operators that didn't have one. And, I've changed the behavior of various binary operators with more or fewer than 2 arguments to make the shadow and real versions more consistent and to make the behavior more logical in either case. For details, see the additions to NEWS and the new file tests/native_tests/operators.hy, which simultaneously tests shadow and real operators.

Although there are a lot of changes, I've put them all in one commit because they're interdependent.
2017-04-13 19:42:01 -05:00
Kodi Arfer
18acfe6495 Revert the extension of with-decorator to setv
This is no longer necessary now that `defn` always produces a `FunctionDef`.

To compensate, I've made small edits to two contrib modules and reverted a small test change.
2017-04-13 06:36:00 +03:00
Kodi Arfer
7c203abe4d Fix bug with unset __name__ of one-line functions
The bug was a regression that I introduced in #1228.

I've created a new special form named `fn*` that works like the old `fn` (that is, it always creates a `FunctionDef`). Since this is intended only for internal use, like `with*`, I haven't documented it.
2017-04-13 06:36:00 +03:00
Kodi Arfer
491b474e7f Make setv return None for more types of rvalues 2017-04-07 21:21:19 +03:00
Kodi Arfer
286d568959 Fix a crash when tokenizing a single quote 2017-04-07 21:12:17 +03:00
Tuukka Turto
4a5e2fd852 Merge branch 'master' into walk-loop 2017-04-01 08:15:10 +03:00
Kodi Arfer
a7085138f6 Add tests for #533 2017-03-30 16:10:34 -07:00
Kodi Arfer
5aadeba3fe Fix bug: loop replaced strings equal to "recur" 2017-03-30 15:49:10 -07:00
Kodi Arfer
e478008cce Fix HyMacroExpansionError underline alignment 2017-03-24 11:09:30 -07:00
Kodi Arfer
ca1bd0ffd3 Add a test for as-> in the REPL
Closes #1255.
2017-03-24 09:03:55 -07:00
Kodi Arfer
33a696d487 Add a command-line option --repl-output-fn (especially for hy.contrib.hy-repr) 2017-03-24 09:03:12 -07:00