-
Notifications
You must be signed in to change notification settings - Fork 128
feat(rpc): extend search path, remove cd #1137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
cryptol-remote-api/python/tests/cryptol/test-files/test-subdir/Bar.cry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module Bar where | ||
|
|
||
| id : {n} (fin n) => [n] -> [n] | ||
| id a = a | ||
|
|
||
| theAnswer : [8] | ||
| theAnswer = 42 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import unittest | ||
| from pathlib import Path | ||
| import os | ||
| from pathlib import Path | ||
| import subprocess | ||
| import time | ||
| import unittest | ||
| import signal | ||
| from distutils.spawn import find_executable | ||
| import cryptol | ||
| import argo_client.connection as argo | ||
| import cryptol.cryptoltypes | ||
| from cryptol import solver | ||
| from cryptol.bitvector import BV | ||
| from BitVector import * #type: ignore | ||
|
|
||
|
|
||
| # Tests of the core server functionality and less | ||
| # focused on intricate Cryptol specifics per se. | ||
|
|
||
| class BasicServerTests(unittest.TestCase): | ||
| # Connection to cryptol | ||
| c = None | ||
|
|
||
| @classmethod | ||
| def setUpClass(self): | ||
| self.c = cryptol.connect() | ||
|
|
||
| @classmethod | ||
| def tearDownClass(self): | ||
| if self.c: | ||
| self.c.reset() | ||
|
|
||
| def test_extend_search_path(self): | ||
| """Test that extending the search path acts as expected w.r.t. loads.""" | ||
| c = self.c | ||
|
|
||
| c.extend_search_path(str(Path('tests','cryptol','test-files', 'test-subdir'))) | ||
| c.load_module('Bar') | ||
| ans1 = c.evaluate_expression("theAnswer").result() | ||
| ans2 = c.evaluate_expression("id theAnswer").result() | ||
| self.assertEqual(ans1, ans2) | ||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
7 changes: 7 additions & 0 deletions
7
cryptol-remote-api/python/tests/cryptol_eval/test-files/test-subdir/Bar.cry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| module Bar where | ||
|
|
||
| id : {n} (fin n) => [n] -> [n] | ||
| id a = a | ||
|
|
||
| theAnswer : [8] | ||
| theAnswer = 42 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| {-# LANGUAGE OverloadedStrings #-} | ||
| module CryptolServer.ExtendSearchPath | ||
| ( extSearchPath | ||
| , extSearchPathDescr | ||
| , ExtendSearchPathParams(..) | ||
| ) where | ||
|
|
||
|
|
||
| import qualified Argo | ||
| import qualified Argo.Doc as Doc | ||
| import Data.Aeson as JSON ( (.:), withObject, FromJSON(parseJSON) ) | ||
|
|
||
| import CryptolServer | ||
|
|
||
| -- | Documentation for @extendSearchPath@ | ||
| extSearchPathDescr :: Doc.Block | ||
| extSearchPathDescr = | ||
| Doc.Paragraph | ||
| [Doc.Text "Extend the server's search path with the given paths."] | ||
|
|
||
| -- | Extend the search path with the provided directories. | ||
| extSearchPath :: ExtendSearchPathParams -> CryptolCommand () | ||
| extSearchPath (ExtendSearchPathParams newDirs) = | ||
| CryptolCommand $ const $ Argo.modifyState (extendSearchPath newDirs) | ||
|
|
||
| data ExtendSearchPathParams | ||
| = ExtendSearchPathParams [FilePath] | ||
|
|
||
| instance FromJSON ExtendSearchPathParams where | ||
| parseJSON = | ||
| withObject "params for \"extend search path\"" $ | ||
| \o -> ExtendSearchPathParams <$> o .: "paths" | ||
|
|
||
| instance Doc.DescribedParams ExtendSearchPathParams where | ||
| parameterFieldDescription = | ||
| [("paths", | ||
| Doc.Paragraph [Doc.Text "The paths to add to the search path."]) | ||
| ] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.